From 4524946f43c7aa3a61c9a25e5b4aa997d4819666 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Fri, 19 Apr 2024 09:53:52 -0500 Subject: [PATCH] bump the timeout and make sure we're not done loading --- src/state/megaStore.tsx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/state/megaStore.tsx b/src/state/megaStore.tsx index b6dbaa3d..d4c2ffa4 100644 --- a/src/state/megaStore.tsx +++ b/src/state/megaStore.tsx @@ -204,20 +204,23 @@ export const Provider: ParentComponent = (props) => { await setSettings(settings); } - // 60 seconds to load or we bail + // 90 seconds to load or we bail const start = Date.now(); - const MAX_LOAD_TIME = 60000; + const MAX_LOAD_TIME = 90000; const interval = setInterval(() => { console.log("Running setup", Date.now() - start); if (Date.now() - start > MAX_LOAD_TIME) { clearInterval(interval); - // Have to set state error here because throwing doesn't work if WASM panics - setState({ - setup_error: new Error( - "Load timed out, please try again" - ) - }); - return; + // Only want to do this if we're really not done loading + if (state.load_stage !== "done") { + // Have to set state error here because throwing doesn't work if WASM panics + setState({ + setup_error: new Error( + "Load timed out, please try again" + ) + }); + return; + } } }, 1000);