Улучшение BUCServer

This commit is contained in:
Book Pauk
2024-07-26 15:54:41 +07:00
parent 613230256a
commit d634ebf14c
2 changed files with 9 additions and 1 deletions

View File

@@ -56,6 +56,9 @@ module.exports = {
ip: '0.0.0.0',
port: '33443',
accessToken: '',
shciForHost: {
'samlib.ru': 300000
},
}*/
],

View File

@@ -51,6 +51,7 @@ class BUCServer {
this.checkQueue = [];
this.hostChecking = {};
this.shciForHost = this.config.shciForHost || {};//sameHostCheckInterval for host
this.main(); //no await
@@ -316,7 +317,11 @@ class BUCServer {
log(LM_ERR, `error ${row.id} > ${e.stack ? e.stack : e.message}`);
} finally {
(async() => {
await utils.sleep(this.sameHostCheckInterval);
const sameHostCheckInterval = this.shciForHost[url.hostname] || this.sameHostCheckInterval;
log(`delay ${sameHostCheckInterval}ms for host '${url.hostname}'`);
await utils.sleep(sameHostCheckInterval);
this.hostChecking[url.hostname] = false;
})();
}