diff --git a/src/pages/parts/admin/WorkerTestPart.tsx b/src/pages/parts/admin/WorkerTestPart.tsx
index e2dd6780..5f8b9853 100644
--- a/src/pages/parts/admin/WorkerTestPart.tsx
+++ b/src/pages/parts/admin/WorkerTestPart.tsx
@@ -52,14 +52,18 @@ export function WorkerTestPart() {
{ id: string; status: "error" | "success"; error?: Error }[]
>([]);
+ const [buttonDisabled, setButtonDisabled] = useState(false);
+
const [testState, runTests] = useAsyncFn(async () => {
+ setButtonDisabled(true);
function updateWorker(id: string, data: (typeof workerState)[number]) {
setWorkerState((s) => {
return [...s.filter((v) => v.id !== id), data];
});
}
setWorkerState([]);
- for (const worker of workerList) {
+
+ const workerPromises = workerList.map(async (worker) => {
try {
if (worker.url.endsWith("/")) {
updateWorker(worker.id, {
@@ -67,7 +71,7 @@ export function WorkerTestPart() {
status: "error",
error: new Error("URL ends with slash"),
});
- continue;
+ return;
}
await singularProxiedFetch(
worker.url,
@@ -85,7 +89,10 @@ export function WorkerTestPart() {
error: err as Error,
});
}
- }
+ });
+
+ await Promise.all(workerPromises);
+ setTimeout(() => setButtonDisabled(false), 5000);
}, [workerList, setWorkerState]);
return (
@@ -112,7 +119,12 @@ export function WorkerTestPart() {
})}
-