From d9dea3471ff6fc030802e912ab01ac2fecae0225 Mon Sep 17 00:00:00 2001 From: Gero Posmyk-Leinemann Date: Thu, 2 Jun 2022 08:18:49 +0000 Subject: [PATCH] [bridge] Use PrebuildUpdater in MetaInstanceController when stopping workspace instances waiting for an imagebuild --- .../ws-manager-bridge/src/meta-instance-controller.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/ws-manager-bridge/src/meta-instance-controller.ts b/components/ws-manager-bridge/src/meta-instance-controller.ts index 3b5d0b98ed9196..e9d893f622d4ed 100644 --- a/components/ws-manager-bridge/src/meta-instance-controller.ts +++ b/components/ws-manager-bridge/src/meta-instance-controller.ts @@ -11,6 +11,7 @@ import { Disposable, DisposableCollection, RunningWorkspaceInfo } from "@gitpod/ import { MessageBusIntegration } from "./messagebus-integration"; import { Configuration } from "./config"; import { repeat } from "@gitpod/gitpod-protocol/lib/util/repeat"; +import { PrebuildUpdater } from "./prebuild-updater"; @injectable() export class MetaInstanceController implements Disposable { @@ -23,6 +24,9 @@ export class MetaInstanceController implements Disposable { @inject(WorkspaceDB) protected readonly workspaceDB: WorkspaceDB; + @inject(PrebuildUpdater) + protected readonly prebuildUpdater: PrebuildUpdater; + protected readonly disposables = new DisposableCollection(); protected async checkAndStopWorkspaces() { @@ -77,6 +81,8 @@ export class MetaInstanceController implements Disposable { instance.workspace.ownerId, instance.latestInstance, ); + + await this.prebuildUpdater.stopPrebuildInstance({}, instance.latestInstance); } } catch (err) { log.warn(logContext, "MetaInstanceController: Error whilst stopping workspace instance", err);