Skip to content

Commit ffdc7df

Browse files
committed
Pass URL
We already pass the token and since we check the URL before calling monitorMetadata I think it makes more sense to pass in the URL we checked over getting it off the global again.
1 parent 91428b2 commit ffdc7df

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/workspacesProvider.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
5656
const showMetadata = this.getWorkspacesQuery === WorkspaceQuery.Mine
5757
if (showMetadata && token) {
5858
const agents = extractAgents(workspace)
59-
agents.forEach((agent) => this.monitorMetadata(agent.id, token)) // monitor metadata for all agents
59+
agents.forEach((agent) => this.monitorMetadata(agent.id, url, token)) // monitor metadata for all agents
6060
}
6161
return new WorkspaceTreeItem(workspace, this.getWorkspacesQuery === WorkspaceQuery.All, showMetadata)
6262
})
@@ -100,8 +100,8 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
100100

101101
// monitorMetadata opens an SSE endpoint to monitor metadata on the specified
102102
// agent and registers a disposer that can be used to stop the watch.
103-
monitorMetadata(agentId: WorkspaceAgent["id"], token: string): void {
104-
const agentMetadataURL = new URL(`${this.storage.getURL()}/api/v2/workspaceagents/${agentId}/watch-metadata`)
103+
monitorMetadata(agentId: WorkspaceAgent["id"], url: string, token: string): void {
104+
const agentMetadataURL = new URL(`${url}/api/v2/workspaceagents/${agentId}/watch-metadata`)
105105
const agentMetadataEventSource = new EventSource(agentMetadataURL.toString(), {
106106
headers: {
107107
"Coder-Session-Token": token,

0 commit comments

Comments
 (0)