Улучшение BUCServer

This commit is contained in:
Book Pauk
2024-07-26 17:19:45 +07:00
parent d634ebf14c
commit afd4d02dad

View File

@@ -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;
})(); })();
} }