File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -464,6 +464,13 @@ export class DBOS {
464464 recordDBOSLaunch ( ) ;
465465
466466 const executor : DBOSExecutor = DBOSExecutor . globalInstance ;
467+
468+ // Initialize data sources before executor.init() dispatches recovery, so recovered
469+ // workflows can run their transactions immediately instead of racing initialization.
470+ for ( const [ _n , ds ] of transactionalDataSources ) {
471+ await ds . initialize ( ) ;
472+ }
473+
467474 await executor . init ( ) ;
468475
469476 // Register the current application version
@@ -476,9 +483,6 @@ export class DBOS {
476483 }
477484
478485 await DBOSExecutor . globalInstance . initEventReceivers ( this . #dbosConfig?. listenQueues || null ) ;
479- for ( const [ _n , ds ] of transactionalDataSources ) {
480- await ds . initialize ( ) ;
481- }
482486
483487 if ( globalParams . dbosCloud ) {
484488 const cloudAppName = process . env . DBOS__CONDUCTOR_APP_NAME ;
You can’t perform that action at this time.
0 commit comments