Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8134f1f

Browse files
Recreate REST client after starting a workspace (part 2) (#436)
Co-authored-by: Benjamin Peinhardt <ben.peinhardt@coder.com>
1 parent71f5ba5 commit8134f1f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

‎CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
##Unreleased
44

5+
###Fixed
6+
7+
- Recreate REST client in spots where confirmStart may have waited indefinitely.
8+
59
##[v1.4.0](https://github.com/coder/vscode-coder/releases/tag/v1.3.9) (2025-02-04)
610

711
- Recreate REST client after starting a workspace to ensure fresh TLS certificates.

‎src/remote.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ export class Remote {
5151
* Try to get the workspace running. Return undefined if the user canceled.
5252
*/
5353
privateasyncmaybeWaitForRunning(
54-
restClient:Api,
5554
workspace:Workspace,
5655
label:string,
5756
binPath:string,
57+
baseUrlRaw:string,
58+
token:string,
5859
):Promise<Workspace|undefined>{
5960
constworkspaceName=`${workspace.owner_name}/${workspace.name}`
6061

@@ -94,6 +95,7 @@ export class Remote {
9495
title:"Waiting for workspace build...",
9596
},
9697
async()=>{
98+
letrestClient=awaitmakeCoderSdk(baseUrlRaw,token,this.storage)
9799
constglobalConfigDir=path.dirname(this.storage.getSessionTokenPath(label))
98100
while(workspace.latest_build.status!=="running"){
99101
++attempts
@@ -109,6 +111,9 @@ export class Remote {
109111
if(!(awaitthis.confirmStart(workspaceName))){
110112
returnundefined
111113
}
114+
// Recreate REST client since confirmStart may have waited an
115+
// indeterminate amount of time for confirmation.
116+
restClient=awaitmakeCoderSdk(baseUrlRaw,token,this.storage)
112117
writeEmitter=initWriteEmitterAndTerminal()
113118
this.storage.writeToCoderOutputChannel(`Starting${workspaceName}...`)
114119
workspace=awaitstartWorkspaceIfStoppedOrFailed(
@@ -126,6 +131,9 @@ export class Remote {
126131
if(!(awaitthis.confirmStart(workspaceName))){
127132
returnundefined
128133
}
134+
// Recreate REST client since confirmStart may have waited an
135+
// indeterminate amount of time for confirmation.
136+
restClient=awaitmakeCoderSdk(baseUrlRaw,token,this.storage)
129137
writeEmitter=initWriteEmitterAndTerminal()
130138
this.storage.writeToCoderOutputChannel(`Starting${workspaceName}...`)
131139
workspace=awaitstartWorkspaceIfStoppedOrFailed(
@@ -316,7 +324,7 @@ export class Remote {
316324

317325
// If the workspace is not in a running state, try to get it running.
318326
if(workspace.latest_build.status!=="running"){
319-
if(!(awaitthis.maybeWaitForRunning(workspaceRestClient,workspace,parts.label,binaryPath))){
327+
if(!(awaitthis.maybeWaitForRunning(workspace,parts.label,binaryPath,baseUrlRaw,token))){
320328
// User declined to start the workspace.
321329
awaitthis.closeRemote()
322330
}else{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp