Skip to content

Commit c84797b

Browse files
committed
ashers trying
1 parent 608f116 commit c84797b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/api.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,17 @@ export async function startWorkspace(restClient: Api, workspace: Workspace): Pro
104104
: // Default to not updating the workspace if not required.
105105
workspace.latest_build.template_version_id
106106

107-
const latestBuild = await restClient.startWorkspace(workspace.id, versionID)
108107
// Before we start a workspace, we make an initial request to check it's not already started
109-
// let latestBuild = (await restClient.getWorkspace(workspace.id)).latest_build
110-
// if (!["starting", "running"].includes(latestBuild.status)) {
108+
const updatedWorkspace = await restClient.getWorkspace(workspace.id)
109+
110+
if (["starting", "running"].includes(updatedWorkspace.latest_build.status)) {
111+
return updatedWorkspace
112+
}
111113

112-
// }
114+
const latestBuild = await restClient.startWorkspace(updatedWorkspace.id, versionID)
113115

114116
return {
115-
...workspace,
117+
...updatedWorkspace,
116118
latest_build: latestBuild,
117119
}
118120
}

0 commit comments

Comments
 (0)