File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
internal-packages/run-engine/src/batch-queue Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -687,16 +687,20 @@ export class BatchQueue {
687687 if ( this . completionCallback ) {
688688 try {
689689 await this . completionCallback ( result ) ;
690+ // Only cleanup if callback succeeded - preserves Redis data for retry on failure
691+ await this . completionTracker . cleanup ( batchId ) ;
690692 } catch ( error ) {
691693 this . logger . error ( "Error in batch completion callback" , {
692694 batchId,
693695 error : error instanceof Error ? error . message : String ( error ) ,
694696 } ) ;
697+ // Re-throw to preserve Redis data and signal failure to callers
698+ throw error ;
695699 }
700+ } else {
701+ // No callback, safe to cleanup
702+ await this . completionTracker . cleanup ( batchId ) ;
696703 }
697-
698- // Clean up Redis keys for this batch
699- await this . completionTracker . cleanup ( batchId ) ;
700704 }
701705
702706 // ============================================================================
You can’t perform that action at this time.
0 commit comments