GithubHelp home page GithubHelp logo

bluebird-queue's People

Contributors

christophvitz-itsonix avatar dimitarkolev avatar zackiles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bluebird-queue's Issues

NPM version update

bluebird-queue in npm isn't updated. Method addNowInfront is missing.

Concurrency

I am using a bluebird-queue via NodeJS to queue HTTP endpoints as tasks. Each task has a 3-level Promise dependancy that has to resolve before it is complete.

One Task

GET -> endpoint 1 // returns promise
    GET -> other endpoints in async // returns promise
        POST -> final endpoint // return promise

I put 20,000 of these tasks into the bluebird-queue with queue.add() and then subsequently call queue.start(). All errors are caught and the handlers resolve the Promise so the task can complete.

I have set concurrency to 50. My initial expectation is that the queue will process 50 at any given time but instead it waits for the first 50 to complete before starting on the next 50.

Unfortunately, some of these Requests can take up to 10 secs to complete - and if a single request takes longer to finish, the whole queue stalls until the Promise resolves.

I have tested with promise-queue and it differs from bluebird-queue where the former processes tasks in the queue at max of 50 tasks at any given time instead of per 50 at a time.

Is this intended behaviour?

Here are my config settings:

var Queue = require('bluebird-queue'),
    queue = new Queue({
        concurrency: 50, 
        delay: 10, // ms
        interval: 1 // ms not quite sure what this means
    });

For your reference, here is the link to the stackoverflow question.

onComplete/onError handlers overwriten?

Hi, doesn't the following code overwrites any custom onComplete and onError handlers passed to queue's constructor?

  return new BlueBird(function(resolve, reject) {
    self.onComplete = resolve;
    self.onError = reject;
  });

Queue delay not working as intended

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.

Array check in add() doesn't work

On line 86 of index.js, the if(typeof func === 'array') { check will never be true, since typeof [] === "object". It should be if(func instanceof Array) { instead.

Adding tasks after onComplete

Hi, thank you for your great lib. I have a question though: what happen when I run start() and after onComplete/result promise is fired I add another task? Will it be processed or not?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.