Skip to content

Commit 5cc4e3d

Browse files
Andrew Farriesroboquat
authored andcommitted
Return raw duration from getWorkspaceTimeout
Include the raw duration from getWorkspaceTimeout, ie in the format '60m' before translation to 'short' or 'extended' etc.
1 parent d9bf64f commit 5cc4e3d

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

components/gitpod-protocol/go/gitpod-service.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,8 +1707,9 @@ type StartWorkspaceOptions struct {
17071707

17081708
// GetWorkspaceTimeoutResult is the GetWorkspaceTimeoutResult message type
17091709
type GetWorkspaceTimeoutResult struct {
1710-
CanChange bool `json:"canChange,omitempty"`
1711-
Duration string `json:"duration,omitempty"`
1710+
CanChange bool `json:"canChange,omitempty"`
1711+
DurationRaw string `json:"durationRaw,omitempty"`
1712+
Duration string `json:"duration,omitempty"`
17121713
}
17131714

17141715
// WorkspaceInstancePort is the WorkspaceInstancePort message type

components/gitpod-protocol/src/gitpod-service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ export interface SetWorkspaceTimeoutResult {
380380

381381
export interface GetWorkspaceTimeoutResult {
382382
duration: WorkspaceTimeoutDuration;
383+
durationRaw: string;
383384
canChange: boolean;
384385
}
385386

components/server/ee/src/workspace/gitpod-server-impl.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
356356
const runningInstance = await this.workspaceDb.trace(ctx).findRunningInstance(workspaceId);
357357
if (!runningInstance) {
358358
log.warn({ userId: user.id, workspaceId }, "Can only get keep-alive for running workspaces");
359-
return { duration: WORKSPACE_TIMEOUT_DEFAULT_SHORT, canChange };
359+
const duration = WORKSPACE_TIMEOUT_DEFAULT_SHORT;
360+
return { duration, durationRaw: this.userService.workspaceTimeoutToDuration(duration), canChange };
360361
}
361362
await this.guardAccess({ kind: "workspaceInstance", subject: runningInstance, workspace: workspace }, "get");
362363

@@ -366,7 +367,9 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
366367
const client = await this.workspaceManagerClientProvider.get(runningInstance.region);
367368
const desc = await client.describeWorkspace(ctx, req);
368369
const duration = this.userService.durationToWorkspaceTimeout(desc.getStatus()!.getSpec()!.getTimeout());
369-
return { duration, canChange };
370+
const durationRaw = this.userService.workspaceTimeoutToDuration(duration);
371+
372+
return { duration, durationRaw, canChange };
370373
}
371374

372375
public async isPrebuildDone(ctx: TraceContext, pwsId: string): Promise<boolean> {

0 commit comments

Comments
 (0)