Skip to content

Commit d17b9df

Browse files
committed
Rely on the websocket to get all the logs instead of fetching the initial ones beforehand
1 parent b554b1a commit d17b9df

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/api/workspace.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,9 @@ export async function waitForBuild(
9494
writeEmitter: vscode.EventEmitter<string>,
9595
workspace: Workspace,
9696
): Promise<Workspace> {
97-
// This fetches the initial bunch of logs.
98-
const logs = await client.getWorkspaceBuildLogs(workspace.latest_build.id);
99-
for (const log of logs) {
100-
writeEmitter.fire(log.output + "\r\n");
101-
}
102-
10397
const socket = await client.watchBuildLogsByBuildId(
10498
workspace.latest_build.id,
105-
logs,
99+
[],
106100
);
107101

108102
await new Promise<void>((resolve, reject) => {
@@ -148,13 +142,7 @@ export async function streamAgentLogs(
148142
socket: OneWayWebSocket<WorkspaceAgentLog[]>;
149143
completion: Promise<void>;
150144
}> {
151-
// This fetches the initial bunch of logs.
152-
const logs = await client.getWorkspaceAgentLogs(agent.id);
153-
for (const log of logs) {
154-
writeEmitter.fire(log.output + "\r\n");
155-
}
156-
157-
const socket = await client.watchWorkspaceAgentLogs(agent.id, logs);
145+
const socket = await client.watchWorkspaceAgentLogs(agent.id, []);
158146

159147
const completion = new Promise<void>((resolve, reject) => {
160148
socket.addEventListener("message", (data) => {

0 commit comments

Comments
 (0)