async-kit
async-kit copied to clipboard
How to add job after exec()?
I'm trying to add jobs after exec but failed.
It seems that you haven't added the async.Queue
.
async.Queue: job can be added after exec(), forever, until quit() is called (it needs some brainstorming here), basicaly, some work should be done to move jobs from async.Plan to async.ExecContext Is there any way to do so? Thank you!
Sorry but this lib is deprecated, it was useful during the callback era, but now with the advent of async/await/promises, there are better alternatives. I migrated away from it for years.
I have this lib: https://github.com/cronvel/seventh, that I use daily as a replacement, but I never had time to write the doc for it. But there are plenty unit tests if you are curious.
const seventh = require( 'seventh' ) ;
var jobRunner = data => doSomething() ;
var queue = new seventh.Queue( jobRunner , 1 ) ;
queue.run() ;
queue.add( "id1" ) ; // add a job without data
queue.add( "id2" , data2 ) ; // add a job with data to be passed to the job runner
queue.add( "id3" , data3 , [ "id1" , "id2" ] ) ; // add a job with data, and with an array of dependencies (IDs of jobs)
// ...
await queue.idle ;