@@ -12,29 +12,26 @@ const logger = parentLogger.child({ module: 'MediaWikiTemporalService' });
1212class TemporalMediaWikiService extends TemporalCoreService {
1313 public async executeWorkflow ( platformId : Types . ObjectId ) {
1414 const client : Client = await this . getClient ( ) ;
15- const payload = {
16- platform_id : platformId ,
17- } ;
15+ const payload = platformId ;
1816 try {
19- const workflowHandle = await client . workflow . execute ( 'MediaWikiETLWorkflow' , {
17+ client . workflow . execute ( 'MediaWikiETLWorkflow' , {
2018 taskQueue : queues . TEMPORAL_QUEUE_PYTHON_HEAVY ,
2119 args : [ payload ] ,
22- workflowId : `mediawiki/ ${ platformId } / ${ uuidv4 ( ) } ` ,
20+ workflowId : `api:mediawikietl: ${ platformId } ` ,
2321 } ) ;
24- logger . info ( `Started MediaWiki workflow with ID: ${ workflowHandle } ` ) ;
25- return workflowHandle ;
2622 } catch ( error ) {
2723 logger . error ( `Failed to trigger MediaWiki workflow: ${ ( error as Error ) . message } ` ) ;
2824 throw new Error ( `Failed to trigger MediaWiki workflow: ${ ( error as Error ) . message } ` ) ;
2925 }
3026 }
3127
32- public async terminateWorkflow ( workflowId : string ) : Promise < void > {
28+ public async terminateWorkflow ( platformId : Types . ObjectId ) : Promise < void > {
3329 const client : Client = await this . getClient ( ) ;
34- const handle = client . workflow . getHandle ( workflowId ) ;
35- const description = await handle . describe ( ) ;
36- if ( description . status . name !== 'TERMINATED' && description . status . name !== 'COMPLETED' ) {
37- await handle . terminate ( 'Terminated due to schedule deletion' ) ;
30+ try {
31+ client . workflow . getHandle ( `api:mediawikietl:${ platformId } ` ) . terminate ( ) ;
32+ } catch ( error ) {
33+ logger . error ( `Failed to terminate MediaWiki workflow: ${ ( error as Error ) . message } ` ) ;
34+ throw new Error ( `Failed to terminate MediaWiki workflow: ${ ( error as Error ) . message } ` ) ;
3835 }
3936 }
4037}
0 commit comments