Skip to content

Commit a7ed1ee

Browse files
committed
updates baby
1 parent 9ad58c4 commit a7ed1ee

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export async function makeCoderSdk(baseUrl: string, token: string | undefined, s
9494
/**
9595
* Start or update a workspace and return the updated workspace.
9696
*/
97-
export async function startWorkspace(restClient: Api, workspace: Workspace): Promise<Workspace> {
97+
export async function startWorkspaceIfStoppedOrFailed(restClient: Api, workspace: Workspace): Promise<Workspace> {
9898
// If the workspace requires the latest active template version, we should attempt
9999
// to update that here.
100100
// TODO: If param set changes, what do we do??
@@ -107,7 +107,7 @@ export async function startWorkspace(restClient: Api, workspace: Workspace): Pro
107107
// Before we start a workspace, we make an initial request to check it's not already started
108108
const updatedWorkspace = await restClient.getWorkspace(workspace.id)
109109

110-
if (["starting", "running"].includes(updatedWorkspace.latest_build.status)) {
110+
if (!["stopped", "failed"].includes(updatedWorkspace.latest_build.status)) {
111111
return updatedWorkspace
112112
}
113113

src/remote.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as path from "path"
1010
import prettyBytes from "pretty-bytes"
1111
import * as semver from "semver"
1212
import * as vscode from "vscode"
13-
import { makeCoderSdk, startWorkspace, waitForBuild } from "./api"
13+
import { makeCoderSdk, startWorkspaceIfStoppedOrFailed, waitForBuild } from "./api"
1414
import { extractAgents } from "./api-helper"
1515
import * as cli from "./cliManager"
1616
import { Commands } from "./commands"
@@ -105,7 +105,7 @@ export class Remote {
105105
return undefined
106106
}
107107
this.storage.writeToCoderOutputChannel(`Starting ${workspaceName}...`)
108-
workspace = await startWorkspace(restClient, workspace)
108+
workspace = await startWorkspaceIfStoppedOrFailed(restClient, workspace)
109109
break
110110
case "failed":
111111
// On a first attempt, we will try starting a failed workspace
@@ -115,7 +115,7 @@ export class Remote {
115115
return undefined
116116
}
117117
this.storage.writeToCoderOutputChannel(`Starting ${workspaceName}...`)
118-
workspace = await startWorkspace(restClient, workspace)
118+
workspace = await startWorkspaceIfStoppedOrFailed(restClient, workspace)
119119
break
120120
}
121121
// Otherwise fall through and error.

0 commit comments

Comments
 (0)