Улучшение BUCServer
This commit is contained in:
@@ -56,6 +56,9 @@ module.exports = {
|
|||||||
ip: '0.0.0.0',
|
ip: '0.0.0.0',
|
||||||
port: '33443',
|
port: '33443',
|
||||||
accessToken: '',
|
accessToken: '',
|
||||||
|
shciForHost: {
|
||||||
|
'samlib.ru': 300000
|
||||||
|
},
|
||||||
}*/
|
}*/
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ class BUCServer {
|
|||||||
|
|
||||||
this.checkQueue = [];
|
this.checkQueue = [];
|
||||||
this.hostChecking = {};
|
this.hostChecking = {};
|
||||||
|
this.shciForHost = this.config.shciForHost || {};//sameHostCheckInterval for host
|
||||||
|
|
||||||
this.main(); //no await
|
this.main(); //no await
|
||||||
|
|
||||||
@@ -316,7 +317,11 @@ 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() => {
|
||||||
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;
|
this.hostChecking[url.hostname] = false;
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user