File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -104,15 +104,17 @@ export async function startWorkspace(restClient: Api, workspace: Workspace): Pro
104
104
: // Default to not updating the workspace if not required.
105
105
workspace . latest_build . template_version_id
106
106
107
- const latestBuild = await restClient . startWorkspace ( workspace . id , versionID )
108
107
// 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
+ }
111
113
112
- // }
114
+ const latestBuild = await restClient . startWorkspace ( updatedWorkspace . id , versionID )
113
115
114
116
return {
115
- ...workspace ,
117
+ ...updatedWorkspace ,
116
118
latest_build : latestBuild ,
117
119
}
118
120
}
You can’t perform that action at this time.
0 commit comments