Browse Source

fix: wait for network to unsuspend before update

tophf 1 year ago
parent
commit
2516d02095
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/background/utils/update.js

+ 3 - 2
src/background/utils/update.js

@@ -17,7 +17,7 @@ const FAST_CHECK = {
   headers: { Accept: 'text/x-userscript-meta,*/*' },
 };
 
-init.then(() => setTimeout(autoUpdate, 20e3));
+init.then(autoUpdate);
 hookOptions(changes => 'autoUpdate' in changes && autoUpdate());
 
 addOwnCommands({
@@ -148,7 +148,8 @@ function autoUpdate() {
   if (!interval) return;
   let elapsed = Date.now() - getOption('lastUpdate');
   if (elapsed >= interval) {
-    commands.CheckUpdate();
+    // Wait on startup for things to settle and after unsuspend for network reconnection
+    setTimeout(commands.CheckUpdate, 20e3);
     elapsed = 0;
   }
   clearTimeout(autoUpdate.timer);