@@ -639,7 +639,7 @@ describe("RunEngine heartbeats", () => {
639
639
containerTest ( "Heartbeat keeps run alive" , async ( { prisma, redisOptions } ) => {
640
640
const authenticatedEnvironment = await setupAuthenticatedEnvironment ( prisma , "PRODUCTION" ) ;
641
641
642
- const executingTimeout = 100 ;
642
+ const executingTimeout = 500 ;
643
643
644
644
const engine = new RunEngine ( {
645
645
prisma,
@@ -706,7 +706,7 @@ describe("RunEngine heartbeats", () => {
706
706
prisma
707
707
) ;
708
708
709
- await setTimeout ( 1000 ) ;
709
+ await setTimeout ( 500 ) ;
710
710
711
711
//dequeue the run
712
712
const dequeued = await engine . dequeueFromWorkerQueue ( {
@@ -726,24 +726,23 @@ describe("RunEngine heartbeats", () => {
726
726
expect ( executionData . snapshot . executionStatus ) . toBe ( "EXECUTING" ) ;
727
727
expect ( executionData . run . status ) . toBe ( "EXECUTING" ) ;
728
728
729
- // Send heartbeats every 50ms (half the timeout )
730
- for ( let i = 0 ; i < 6 ; i ++ ) {
731
- await setTimeout ( 50 ) ;
729
+ // Send heartbeats every 100ms (to make sure we're not timing out )
730
+ for ( let i = 0 ; i < 5 ; i ++ ) {
731
+ await setTimeout ( 100 ) ;
732
732
await engine . heartbeatRun ( {
733
733
runId : run . id ,
734
734
snapshotId : attempt . snapshot . id ,
735
735
} ) ;
736
736
}
737
737
738
- // After 300ms (3x the timeout) the run should still be executing
739
- // because we've been sending heartbeats
738
+ // Should still be executing because we're sending heartbeats
740
739
const executionData2 = await engine . getRunExecutionData ( { runId : run . id } ) ;
741
740
assertNonNullable ( executionData2 ) ;
742
741
expect ( executionData2 . snapshot . executionStatus ) . toBe ( "EXECUTING" ) ;
743
742
expect ( executionData2 . run . status ) . toBe ( "EXECUTING" ) ;
744
743
745
744
// Stop sending heartbeats and wait for timeout
746
- await setTimeout ( executingTimeout * 3 ) ;
745
+ await setTimeout ( executingTimeout * 2 ) ;
747
746
748
747
// Now it should have timed out and be queued
749
748
const executionData3 = await engine . getRunExecutionData ( { runId : run . id } ) ;
0 commit comments