浏览代码

Улучшение BUCServer

Book Pauk 11 月之前
父节点
当前提交
afd4d02dad
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      server/core/BookUpdateChecker/BUCServer.js

+ 3 - 2
server/core/BookUpdateChecker/BUCServer.js

@@ -317,11 +317,12 @@ class BUCServer {
                         log(LM_ERR, `error ${row.id} > ${e.stack ? e.stack : e.message}`);
                         log(LM_ERR, `error ${row.id} > ${e.stack ? e.stack : e.message}`);
                     } finally {
                     } finally {
                         (async() => {
                         (async() => {
-                            const sameHostCheckInterval = this.shciForHost[url.hostname] || this.sameHostCheckInterval;
+                            let sameHostCheckInterval = this.shciForHost[url.hostname] || this.sameHostCheckInterval;
+                            sameHostCheckInterval = Math.round((Math.random() - 0.5)*(sameHostCheckInterval*0.2) + sameHostCheckInterval);
 
 
                             log(`delay ${sameHostCheckInterval}ms for host '${url.hostname}'`);
                             log(`delay ${sameHostCheckInterval}ms for host '${url.hostname}'`);
                             await utils.sleep(sameHostCheckInterval);
                             await utils.sleep(sameHostCheckInterval);
-                            
+
                             this.hostChecking[url.hostname] = false;
                             this.hostChecking[url.hostname] = false;
                         })();
                         })();
                     }
                     }