Skip to content

Queue delay not working as intended #12

@ghost

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions