Skip to content

Commit b4f046b

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 9042bd2 commit b4f046b

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
@@ -67,7 +67,7 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
6767
const showMetadata = this.getWorkspacesQuery === WorkspaceQuery.Mine
6868
if (showMetadata) {
6969
const agents = extractAgents(workspace)
70-
agents.forEach((agent) => this.monitorMetadata(agent.id, token)) // monitor metadata for all agents
70+
agents.forEach((agent) => this.monitorMetadata(agent.id, url, token)) // monitor metadata for all agents
7171
}
7272
return new WorkspaceTreeItem(workspace, this.getWorkspacesQuery === WorkspaceQuery.All, showMetadata)
7373
})
@@ -107,8 +107,8 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
107107

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

0 commit comments

Comments
 (0)