npkgz / cli-progress

:hourglass: easy to use progress-bar for command-line/terminal applications
https://www.npmjs.com/package/cli-progress
MIT License
1.09k stars 84 forks source link

Usage in multithreading (cluster) #114

Closed kolykhalov closed 2 years ago

kolykhalov commented 2 years ago

Hello world! :)

How to use cli-progress in cluster mode (const cluster=require('cluster')) per every worker so that it writes progress-bars independently? Currently if I use SingeBar every update rewrites the current bar from every worker in single line. How to make it update multiline and not overlap each other? Single threaded works like a charm.

Expected:

Master bar: [======= ] Worker 1 bar: [== ] Worker 2 bar: [========= ]

AndiDittrich commented 2 years ago

you have to use a dedicated worker (master( thread which manages the UI components (progress bar). each worker thread has to pass it's status via the build-in messaging system to it

kolykhalov commented 2 years ago

Hello Andi! Thanks for your help and this beautiful library.

cfmj commented 1 year ago

you have to use a dedicated worker (master( thread which manages the UI components (progress bar). each worker thread has to pass it's status via the build-in messaging system to it

can u give some code ?