D
D
dake12312017-11-01 22:10:43
JavaScript
dake1231, 2017-11-01 22:10:43

How to properly work with npm tress package?

https://www.npmjs.com/package/tress - Here is the package itself, I want to use it as a queue.
I declare, in the example of concurrency 2

var myTressJob = tress(function(item, done) {
   console.log(item.id)
}, 2)

By the queue, I understand it this way, there is a cron that runs every ten minutes and pulls records from the database, say 400 pieces, I go through the array and do myTressJob.push (item), and all the cron finishes work, and the queue begins to work.
I expect to see all the id elements in the console, but in reality I get as much as concurrency
I didn’t understand something? How to work with it correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dake1231, 2017-11-01
@dake1231

I remove the question, it was necessary to call done ()) It's time to sleep)

var myTressJob = tress(function(item, done) {
   console.log(item.id);
   done()
}, 2)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question