-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I have a code which makes api call for list of items to fetch data of , then it pulls data of each item. Let's say it looks like following:
var Queue = require('bluebird-queue');
api.getContainer(contaierId)
.then(function (items) {
var itemQueue = new Queue({
concurrency: 1,
delay: 2000
});
itemQueue.add(items.map(function (item) {
return api.getItemDetails(item); // returns promise
}))
return itemQueue.start();
})
.then(function (itemDetails) {
...
});
getContainer and getItemDetails are functions which return Promise, which return request.
After I start the queue, first getItemDetails is called properly after a delay, but then it invokes everything else and waits for the remaining time.
bluebird: v3.4.5
bluebird-queue: v0.0.8
node: v4.4.7
Edit: Posted more accurate example.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels