new(all): Paralel bot loading.

This commit is contained in:
rodrigorodriguez 2022-10-10 01:49:43 -03:00
parent 9fa736918f
commit 907a47cc68
2 changed files with 10 additions and 4 deletions

View file

@ -173,15 +173,14 @@ export class GBMinService {
// Calls mountBot event to all bots. // Calls mountBot event to all bots.
this.bar1 = new cliProgress.SingleBar({ this.bar1 = new cliProgress.SingleBar({
format: '[{bar}] Loading {botId} ({value}/{total})...', barsize: 30, format: '[{bar}] ({value}/{total}) Loading {botId} ...', barsize: 40,
forceRedraw: true forceRedraw: true
}, cliProgress.Presets.rect); }, cliProgress.Presets.rect);
let i = 1; let i = 1;
GBLog.info('Starting bot instance load phase...');
this.bar1.start(instances.length, i, { botId: "Boot" }); this.bar1.start(instances.length, i, { botId: "Boot" });
const throttledPromiseAll = async (promises) => { const throttledPromiseAll = async (promises) => {
const MAX_IN_PROCESS = 15; const MAX_IN_PROCESS = 20;
const results = new Array(promises.length); const results = new Array(promises.length);
async function doBlock(startIndex) { async function doBlock(startIndex) {

View file

@ -144,8 +144,15 @@ export class WhatsappDirectLine extends GBService {
const createClient = async (browserWSEndpoint) => { const createClient = async (browserWSEndpoint) => {
let puppeteer: any = { let puppeteer: any = {
headless: false, args: [ headless: true, args: [
'--no-sandbox',
'--disable-setuid-sandbox', '--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-accelerated-2d-canvas',
'--no-first-run',
'--no-zygote',
'--single-process', // <- this one doesn't works in Windows
'--disable-gpu',
'--disable-infobars', '--disable-infobars',
'--disable-features=site-per-process', '--disable-features=site-per-process',
`--user-data-dir=${localName}`] `--user-data-dir=${localName}`]