@@ -436,6 +436,7 @@ export class WorkspaceManagerBridge implements Disposable {
436
436
clientProvider : ClientProvider ,
437
437
controllerIntervalSeconds : number ,
438
438
controllerMaxDisconnectSeconds : number ,
439
+ maxTimeToRunningPhaseSeconds = 60 * 60 ,
439
440
) {
440
441
let disconnectStarted = Number . MAX_SAFE_INTEGER ;
441
442
this . disposables . push (
@@ -452,7 +453,12 @@ export class WorkspaceManagerBridge implements Disposable {
452
453
453
454
// Control running workspace instances against ws-manager
454
455
try {
455
- await this . controlRunningInstances ( ctx , runningInstances , clientProvider ) ;
456
+ await this . controlRunningInstances (
457
+ ctx ,
458
+ runningInstances ,
459
+ clientProvider ,
460
+ maxTimeToRunningPhaseSeconds ,
461
+ ) ;
456
462
457
463
disconnectStarted = Number . MAX_SAFE_INTEGER ; // Reset disconnect period
458
464
} catch ( err ) {
@@ -489,6 +495,7 @@ export class WorkspaceManagerBridge implements Disposable {
489
495
parentCtx : TraceContext ,
490
496
runningInstances : RunningWorkspaceInfo [ ] ,
491
497
clientProvider : ClientProvider ,
498
+ maxTimeToRunningPhaseSeconds : number ,
492
499
) {
493
500
const installation = this . config . installation ;
494
501
@@ -506,7 +513,10 @@ export class WorkspaceManagerBridge implements Disposable {
506
513
507
514
for ( const [ instanceId , ri ] of runningInstancesIdx . entries ( ) ) {
508
515
const instance = ri . latestInstance ;
509
- if ( instance . status . phase !== "running" ) {
516
+ if (
517
+ instance . status . phase === "pending" &&
518
+ durationLongerThanSeconds ( Date . parse ( instance . creationTime ) , maxTimeToRunningPhaseSeconds )
519
+ ) {
510
520
log . debug ( { instanceId } , "Skipping instance" , {
511
521
phase : instance . status . phase ,
512
522
creationTime : instance . creationTime ,
0 commit comments