Skip to content

Commit

Permalink
Pass URL
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
code-asher committed Feb 1, 2024
1 parent dd7a77d commit 32392e8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/workspacesProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
const showMetadata = this.getWorkspacesQuery === WorkspaceQuery.Mine
if (showMetadata && token) {
const agents = extractAgents(workspace)
agents.forEach((agent) => this.monitorMetadata(agent.id, token)) // monitor metadata for all agents
agents.forEach((agent) => this.monitorMetadata(agent.id, url, token)) // monitor metadata for all agents
}
return new WorkspaceTreeItem(workspace, this.getWorkspacesQuery === WorkspaceQuery.All, showMetadata)
})
Expand Down Expand Up @@ -103,8 +103,8 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte

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

0 comments on commit 32392e8

Please sign in to comment.