6
6
7
7
import { inject , injectable } from "inversify" ;
8
8
import { MessageBusIntegration } from "./messagebus-integration" ;
9
- import { Disposable , WorkspaceInstance , Queue , WorkspaceInstancePort , PortVisibility , RunningWorkspaceInfo } from "@gitpod/gitpod-protocol" ;
9
+ import { Disposable , WorkspaceInstance , Queue , WorkspaceInstancePort , PortVisibility , RunningWorkspaceInfo , DisposableCollection } from "@gitpod/gitpod-protocol" ;
10
10
import { WorkspaceStatus , WorkspacePhase , GetWorkspacesRequest , WorkspaceConditionBool , PortVisibility as WsManPortVisibility , WorkspaceType , PromisifiedWorkspaceManagerClient } from "@gitpod/ws-manager/lib" ;
11
11
import { WorkspaceDB } from "@gitpod/gitpod-db/lib/workspace-db" ;
12
12
import { UserDB } from "@gitpod/gitpod-db/lib/user-db" ;
@@ -20,6 +20,7 @@ import { Timestamp } from "google-protobuf/google/protobuf/timestamp_pb";
20
20
import { Configuration } from "./config" ;
21
21
import { WorkspaceCluster } from "@gitpod/gitpod-protocol/lib/workspace-cluster" ;
22
22
import { repeat } from "@gitpod/gitpod-protocol/lib/util/repeat" ;
23
+ import { PreparingUpdateEmulator } from "./preparing-update-emulator" ;
23
24
24
25
export const WorkspaceManagerBridgeFactory = Symbol ( "WorkspaceManagerBridgeFactory" ) ;
25
26
@@ -53,7 +54,7 @@ export class WorkspaceManagerBridge implements Disposable {
53
54
@inject ( IAnalyticsWriter )
54
55
protected readonly analytics : IAnalyticsWriter ;
55
56
56
- protected readonly disposables : Disposable [ ] = [ ] ;
57
+ protected readonly disposables = new DisposableCollection ( ) ;
57
58
protected readonly queues = new Map < string , Queue > ( ) ;
58
59
59
60
protected cluster : WorkspaceClusterInfo ;
@@ -85,6 +86,11 @@ export class WorkspaceManagerBridge implements Disposable {
85
86
// _DO NOT_ update the DB (another bridge is responsible for that)
86
87
// Still, listen to all updates, generate/derive new state and distribute it locally!
87
88
startStatusUpdateHandler ( false ) ;
89
+
90
+ // emulate WorkspaceInstance updates for all Workspaces in the "preparing" phase in this cluster
91
+ const updateEmulator = new PreparingUpdateEmulator ( ) ;
92
+ this . disposables . push ( updateEmulator ) ;
93
+ updateEmulator . start ( cluster . name ) ;
88
94
}
89
95
log . info ( `started bridge to cluster.` , logPayload ) ;
90
96
}
@@ -366,7 +372,7 @@ export class WorkspaceManagerBridge implements Disposable {
366
372
}
367
373
368
374
public dispose ( ) {
369
- this . disposables . forEach ( d => d . dispose ( ) ) ;
375
+ this . disposables . dispose ( ) ;
370
376
}
371
377
372
378
}
0 commit comments