@@ -30,7 +30,9 @@ export class ManagedRunController {
3030 private readonly logger : RunLogger ;
3131 private readonly taskRunProcessProvider : TaskRunProcessProvider ;
3232
33+ private warmStartEnabled = true ;
3334 private warmStartCount = 0 ;
35+
3436 private restoreCount = 0 ;
3537
3638 private notificationCount = 0 ;
@@ -103,7 +105,12 @@ export class ManagedRunController {
103105 runId : this . runFriendlyId ,
104106 message : "Received SIGTERM, stopping worker" ,
105107 } ) ;
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
107114 } ) ;
108115 }
109116
@@ -276,6 +283,14 @@ export class ManagedRunController {
276283 * the process on any errors or when no runs are available after the configured duration.
277284 */
278285 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+
279294 this . sendDebugLog ( {
280295 runId : this . runFriendlyId ,
281296 message : "waitForNextRun()" ,
@@ -548,7 +563,7 @@ export class ManagedRunController {
548563 return ;
549564 }
550565
551- async stop ( ) {
566+ async cancelRunsAndExitProcess ( ) {
552567 this . sendDebugLog ( {
553568 runId : this . runFriendlyId ,
554569 message : "Shutting down" ,
@@ -578,6 +593,9 @@ export class ManagedRunController {
578593
579594 // Close the socket
580595 this . socket . close ( ) ;
596+
597+ // Exit the process
598+ this . exitProcess ( this . successExitCode ) ;
581599 }
582600
583601 sendDebugLog ( opts : SendDebugLogOptions ) {
0 commit comments