Changed the logic for creating groups of workers

This commit is contained in:
minicx 2022-12-14 17:39:04 +03:00
parent ab094d1fd4
commit a3d735ba6c
2 changed files with 5 additions and 12 deletions

View File

@ -421,17 +421,10 @@ const farm: () => Promise<void> = async () => {
})
}
for (let i = 0; i != workers.length + 1; i += settings.pararels) {
const _workers = workers.slice(i, i + settings.pararels);
if (_workers.length != 0) {
workersGroups.push(_workers);
} else {
break;
}
}
if (workersGroups.length != Math.ceil(workers.length / settings.pararels)) {
logger.warn(`There is strange thing with workersGroups\n${workersGroups.length} ${Math.ceil(workers.length / settings.pararels)}`);
for (let i = 0; i != settings.pararels; i++) {
const startIndex=i*Math.ceil(workers.length / settings.pararels);
const _workers = workers.slice(startIndex, startIndex+Math.ceil(workers.length / settings.pararels));
workersGroups.push(_workers);
}
let pararels: Promise<void>[] = [];

View File

@ -35,7 +35,7 @@
},
"repository": {
"type": "git",
"url": "https://notabug.org/minicx/hk_bot.git"
"url": "https://git.disroot.org/minicx/hk_bot.git"
},
"keywords": [
"telegram",