From 528e991babb367fac5bbce69c250dd49a15fb6b0 Mon Sep 17 00:00:00 2001 From: Jeff MAURY Date: Mon, 5 Feb 2024 10:58:50 +0100 Subject: [PATCH] fix: revert @dgolovin proposal as it causes other issues Signed-off-by: Jeff MAURY --- packages/backend/src/managers/playground.spec.ts | 4 +--- packages/backend/src/managers/playground.ts | 7 +++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/backend/src/managers/playground.spec.ts b/packages/backend/src/managers/playground.spec.ts index 5c21e7484..e61007150 100644 --- a/packages/backend/src/managers/playground.spec.ts +++ b/packages/backend/src/managers/playground.spec.ts @@ -69,9 +69,7 @@ beforeEach(() => { {} as PodmanConnection, ); originalFetch = globalThis.fetch; - globalThis.fetch = vi.fn().mockResolvedValue({ - ok: true, - }); + globalThis.fetch = vi.fn().mockResolvedValue({}); }); afterEach(() => { diff --git a/packages/backend/src/managers/playground.ts b/packages/backend/src/managers/playground.ts index 71df429ec..8e92c7c68 100644 --- a/packages/backend/src/managers/playground.ts +++ b/packages/backend/src/managers/playground.ts @@ -216,11 +216,10 @@ export class PlayGroundManager { this.playgrounds.get(modelId).status === 'starting' ) { try { - const response = await fetch(`http://localhost:${freePort}`); - contacted = response.ok; - await timeout(1000); + await fetch(`http://localhost:${freePort}`); + contacted = true; } catch (err: unknown) { - /* empty */ + await timeout(1000); } }