feat: recording id for shceduled robot
This commit is contained in:
@@ -7,12 +7,23 @@ import { createRemoteBrowserForRun, destroyRemoteBrowser } from '../../browser-m
|
|||||||
import logger from '../../logger';
|
import logger from '../../logger';
|
||||||
import { browserPool } from "../../server";
|
import { browserPool } from "../../server";
|
||||||
import { googleSheetUpdateTasks, processGoogleSheetUpdates } from "../integrations/gsheet";
|
import { googleSheetUpdateTasks, processGoogleSheetUpdates } from "../integrations/gsheet";
|
||||||
|
import { getRecordingByFileName } from "../../routes/storage";
|
||||||
|
|
||||||
async function runWorkflow(fileName: string, runId: string) {
|
async function runWorkflow(fileName: string, runId: string) {
|
||||||
if (!runId) {
|
if (!runId) {
|
||||||
runId = uuid();
|
runId = uuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const recording = await getRecordingByFileName(fileName);
|
||||||
|
|
||||||
|
if (!recording || !recording.recording_meta || !recording.recording_meta.id) {
|
||||||
|
logger.log('info', `Recording with name: ${fileName} not found`);
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: `Recording with name: ${fileName} not found`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const browserId = createRemoteBrowserForRun({
|
const browserId = createRemoteBrowserForRun({
|
||||||
browser: chromium,
|
browser: chromium,
|
||||||
@@ -21,6 +32,7 @@ async function runWorkflow(fileName: string, runId: string) {
|
|||||||
const run_meta = {
|
const run_meta = {
|
||||||
status: 'Scheduled',
|
status: 'Scheduled',
|
||||||
name: fileName,
|
name: fileName,
|
||||||
|
recordingId: recording.recording_meta.id,
|
||||||
startedAt: new Date().toLocaleString(),
|
startedAt: new Date().toLocaleString(),
|
||||||
finishedAt: '',
|
finishedAt: '',
|
||||||
browserId: browserId,
|
browserId: browserId,
|
||||||
|
|||||||
Reference in New Issue
Block a user