Skip to content

Commit

Permalink
fixup! tmp: debug github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tharvik committed Dec 2, 2024
1 parent 3e8a3d5 commit d6c9e65
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
5 changes: 1 addition & 4 deletions discojs/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,7 @@ export abstract class Client extends EventEmitter<{'status': RoundStatus}>{
url.pathname += `tasks/${this.task.id}/model.json`

const response = await fetch(url);
if (!response.ok) {
console.log("Error with response ok")
throw new Error(`fetch: HTTP status ${response.status}`);
}
if (!response.ok) throw new Error(`fetch: HTTP status ${response.status}`);

const encoded = new Uint8Array(await response.arrayBuffer())
return await serialization.model.decode(encoded)
Expand Down
10 changes: 2 additions & 8 deletions discojs/src/task/task_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,14 @@ export async function pushTask<D extends DataType>(
weights: await serialization.weights.encode(model.weights),
}),
});
if (!response.ok) {
console.log("Error with response ok")
throw new Error(`fetch: HTTP status ${response.status}`);
}
if (!response.ok) throw new Error(`fetch: HTTP status ${response.status}`);
}

export async function fetchTasks(
base: URL,
): Promise<Map<TaskID, Task<DataType>>> {
const response = await fetch(urlToTasks(base));
if (!response.ok) {
console.log("Error with response ok")
throw new Error(`fetch: HTTP status ${response.status}`);
}
if (!response.ok) throw new Error(`fetch: HTTP status ${response.status}`);
const tasks: unknown = await response.json();

if (!Array.isArray(tasks)) {
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/testing/__tests__/Testing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ it("shows stored models", async () => {
it("allows to download server's models", async () => {
vi.stubGlobal("fetch", async (url: string | URL) => {
if (url.toString() === "http://localhost:8080/tasks")
return { ok: () => true, json: () => Promise.resolve([TASK]) };
return { json: () => Promise.resolve([TASK]) };
throw new Error(`unhandled get: ${url}`);
});
afterEach(() => {
Expand Down

0 comments on commit d6c9e65

Please sign in to comment.