You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use this library inside of threads, but for some reason I don't see any bars being drawn. It seems to work fine without threads though so I'm hoping someone knows what's going on here?
constProgressBar=require('progress');const{
Worker,
isMainThread,
parentPort,
workerData,}=require('worker_threads');constfiles={'eta.js': 187,'generic-bar.js': 589,'multi-bar.js': 5342,'options.js': 42,'single-bar.js': 2123,'terminal.js': 4123,};if(isMainThread){constentries=Object.entries(files);for(constfileofentries){constworker=newWorker(__filename,{workerData: file});worker.on('message',(data)=>{console.log('... OK',data);});worker.on('error',(err)=>{console.log('[ERR]',err);});worker.on('exit',(code)=>{if(code!==0){console.log(`Worker stopped with exit code ${code}`);}});}}else{console.log('... making new bar',workerData);constbar=newProgressBar(':bar',{total: workerData[1],});consttimer=setInterval(()=>{bar.tick();if(bar.complete){clearInterval(timer);}},3);}
The text was updated successfully, but these errors were encountered:
I'm trying to use this library inside of threads, but for some reason I don't see any bars being drawn. It seems to work fine without threads though so I'm hoping someone knows what's going on here?
The text was updated successfully, but these errors were encountered: