@@ -30,7 +30,9 @@ export class ManagedRunController {
30
30
private readonly logger : RunLogger ;
31
31
private readonly taskRunProcessProvider : TaskRunProcessProvider ;
32
32
33
+ private warmStartEnabled = true ;
33
34
private warmStartCount = 0 ;
35
+
34
36
private restoreCount = 0 ;
35
37
36
38
private notificationCount = 0 ;
@@ -103,7 +105,12 @@ export class ManagedRunController {
103
105
runId : this . runFriendlyId ,
104
106
message : "Received SIGTERM, stopping worker" ,
105
107
} ) ;
106
- await this . stop ( ) ;
108
+
109
+ // Disable warm starts
110
+ this . warmStartEnabled = false ;
111
+
112
+ // ..now we wait for any active runs to finish
113
+ // SIGKILL will handle the rest, nothing to do here
107
114
} ) ;
108
115
}
109
116
@@ -276,6 +283,14 @@ export class ManagedRunController {
276
283
* the process on any errors or when no runs are available after the configured duration.
277
284
*/
278
285
private async waitForNextRun ( ) {
286
+ if ( ! this . warmStartEnabled ) {
287
+ this . sendDebugLog ( {
288
+ runId : this . runFriendlyId ,
289
+ message : "waitForNextRun: warm starts disabled, shutting down" ,
290
+ } ) ;
291
+ this . exitProcess ( this . successExitCode ) ;
292
+ }
293
+
279
294
this . sendDebugLog ( {
280
295
runId : this . runFriendlyId ,
281
296
message : "waitForNextRun()" ,
@@ -548,7 +563,7 @@ export class ManagedRunController {
548
563
return ;
549
564
}
550
565
551
- async stop ( ) {
566
+ async cancelRunsAndExitProcess ( ) {
552
567
this . sendDebugLog ( {
553
568
runId : this . runFriendlyId ,
554
569
message : "Shutting down" ,
@@ -578,6 +593,9 @@ export class ManagedRunController {
578
593
579
594
// Close the socket
580
595
this . socket . close ( ) ;
596
+
597
+ // Exit the process
598
+ this . exitProcess ( this . successExitCode ) ;
581
599
}
582
600
583
601
sendDebugLog ( opts : SendDebugLogOptions ) {
0 commit comments