@@ -17,6 +17,7 @@ import { WorkflowFile } from 'maxun-core';
1717import { cancelScheduledWorkflow , scheduleWorkflow } from '../storage/schedule' ;
1818import { addJob } from '../storage/graphileWorker' ;
1919import { QUEUE_NAMES } from '../task-runner' ;
20+ import { io as serverIo } from '../server' ;
2021import { WorkflowEnricher } from '../sdk/workflowEnricher' ;
2122import sequelizeInstance from '../storage/db' ;
2223import { Op } from 'sequelize' ;
@@ -1996,6 +1997,15 @@ router.post('/runs/document-run/:id', requireSignIn, async (req: AuthenticatedRe
19961997 browserId : runId ,
19971998 } , { maxAttempts : 1 } ) ;
19981999
2000+ serverIo . of ( '/queued-run' ) . to ( `user-${ req . user . id } ` ) . emit ( 'run-started' , {
2001+ runId,
2002+ robotMetaId : recording . recording_meta . id ,
2003+ robotName : recording . recording_meta . name ,
2004+ status : 'running' ,
2005+ startedAt : now ,
2006+ runByUserId : req . user . id ,
2007+ } ) ;
2008+
19992009 logger . log ( 'info' , `Queued document-run ${ runId } for robot ${ recording . recording_meta . id } ` ) ;
20002010 return res . status ( 202 ) . json ( { runId, robotMetaId : recording . recording_meta . id , status : 'running' } ) ;
20012011 } catch ( error : any ) {
@@ -2043,6 +2053,15 @@ router.post('/runs/document-parse-run/:id', requireSignIn, async (req: Authentic
20432053 browserId : runId ,
20442054 } , { maxAttempts : 1 } ) ;
20452055
2056+ serverIo . of ( '/queued-run' ) . to ( `user-${ req . user . id } ` ) . emit ( 'run-started' , {
2057+ runId,
2058+ robotMetaId : recording . recording_meta . id ,
2059+ robotName : recording . recording_meta . name ,
2060+ status : 'running' ,
2061+ startedAt : now ,
2062+ runByUserId : req . user . id ,
2063+ } ) ;
2064+
20462065 logger . log ( 'info' , `Queued document-parse-run ${ runId } for robot ${ recording . recording_meta . id } ` ) ;
20472066 return res . status ( 202 ) . json ( { runId, robotMetaId : recording . recording_meta . id , status : 'running' } ) ;
20482067 } catch ( error : any ) {
0 commit comments