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

Recreate REST client after starting a workspace (part 2)#436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
bcpeinhardt merged 2 commits intocoder:mainfromaaronlehmann:recreate-rest-client-2
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletionsCHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,10 @@

## Unreleased

### Fixed

- Recreate REST client in spots where confirmStart may have waited indefinitely.

## [v1.4.0](https://github.com/coder/vscode-coder/releases/tag/v1.3.9) (2025-02-04)

- Recreate REST client after starting a workspace to ensure fresh TLS certificates.
Expand Down
12 changes: 10 additions & 2 deletionssrc/remote.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,10 +51,11 @@ export class Remote {
* Try to get the workspace running. Return undefined if the user canceled.
*/
private async maybeWaitForRunning(
restClient: Api,
workspace: Workspace,
label: string,
binPath: string,
baseUrlRaw: string,
token: string,
): Promise<Workspace | undefined> {
const workspaceName = `${workspace.owner_name}/${workspace.name}`

Expand DownExpand Up@@ -94,6 +95,7 @@ export class Remote {
title: "Waiting for workspace build...",
},
async () => {
let restClient = await makeCoderSdk(baseUrlRaw, token, this.storage)
const globalConfigDir = path.dirname(this.storage.getSessionTokenPath(label))
while (workspace.latest_build.status !== "running") {
++attempts
Expand All@@ -109,6 +111,9 @@ export class Remote {
if (!(await this.confirmStart(workspaceName))) {
return undefined
}
// Recreate REST client since confirmStart may have waited an
// indeterminate amount of time for confirmation.
restClient = await makeCoderSdk(baseUrlRaw, token, this.storage)
writeEmitter = initWriteEmitterAndTerminal()
this.storage.writeToCoderOutputChannel(`Starting ${workspaceName}...`)
workspace = await startWorkspaceIfStoppedOrFailed(
Expand All@@ -126,6 +131,9 @@ export class Remote {
if (!(await this.confirmStart(workspaceName))) {
return undefined
}
// Recreate REST client since confirmStart may have waited an
// indeterminate amount of time for confirmation.
restClient = await makeCoderSdk(baseUrlRaw, token, this.storage)
writeEmitter = initWriteEmitterAndTerminal()
this.storage.writeToCoderOutputChannel(`Starting ${workspaceName}...`)
workspace = await startWorkspaceIfStoppedOrFailed(
Expand DownExpand Up@@ -316,7 +324,7 @@ export class Remote {

// If the workspace is not in a running state, try to get it running.
if (workspace.latest_build.status !== "running") {
if (!(await this.maybeWaitForRunning(workspaceRestClient,workspace, parts.label, binaryPath))) {
if (!(await this.maybeWaitForRunning(workspace, parts.label, binaryPath, baseUrlRaw, token))) {
// User declined to start the workspace.
await this.closeRemote()
} else {
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp