File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -76,8 +76,6 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
7676
7777 while ( ! stoppingToken . IsCancellationRequested )
7878 {
79-
80-
8179 if ( DateTime . UtcNow - crudeStatsTimer > TimeSpan . FromSeconds ( statsSeconds ) )
8280 {
8381 // Update config
@@ -474,11 +472,16 @@ private async Task StartPoolRunners(List<GithubTargetConfiguration> targetConfig
474472 continue ;
475473 }
476474
477- List < Runner > existingRunners = await db . Runners . Where ( x => x . Owner == owner . Name && x . IsOnline ) . ToListAsync ( ) ;
475+ List < Runner > activeRunners = await db . Runners
476+ . Include ( x => x . Lifecycle )
477+ . Where ( x => x . Owner == owner . Name )
478+ . ToListAsync ( ) ;
479+ // Count runners that are still alive (not yet deleted/failed/cancelled)
480+ activeRunners = activeRunners . Where ( x => x . LastState < RunnerStatus . DeletionQueued ) . ToList ( ) ;
478481
479482 foreach ( Pool pool in owner . Pools )
480483 {
481- int existCt = existingRunners . Count ( x => x . Size == pool . Size ) ;
484+ int existCt = activeRunners . Count ( x => x . Size == pool . Size ) ;
482485 int missingCt = pool . NumRunners - existCt ;
483486
484487 string arch = Program . Config . Sizes . FirstOrDefault ( x => x . Name == pool . Size ) ? . Arch ;
You can’t perform that action at this time.
0 commit comments