From 8bf4efd5c29d78b9abf0185548824bb02c71c5fe Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Mon, 19 Jun 2023 09:43:34 -0700 Subject: [PATCH] fix: stresser exclusions --- packages/daemon/src/stresser.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/daemon/src/stresser.ts b/packages/daemon/src/stresser.ts index a51c3159..365fcb9d 100644 --- a/packages/daemon/src/stresser.ts +++ b/packages/daemon/src/stresser.ts @@ -52,15 +52,18 @@ global.EventSource = require('eventsource') * Stress test */ const stress = async () => { - const instance = shuffle(instances) - .filter((v) => !excluded[v.id]) - .pop()! - const { subdomain, id } = instance - dbg(`Fetching instance ${subdomain}:${id}`) - const url = `https://${subdomain}.pockethost.test` try { + const instance = shuffle(instances) + .filter((v) => !excluded[v.id]) + .pop() + if (!instance) throw new Error(`No instance to grab`) + + const { subdomain, id } = instance + dbg(`Fetching instance ${subdomain}:${id}`) + const url = `https://${subdomain}.pockethost.test/_` const res = await fetch(url) if (res.status !== 200) { + dbg(`${url} failed with ${res.status}`) excluded[id] = true } } catch (e) {