Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

async.queue emits "saturated" event at wrong point #724

Closed
glenjamin opened this issue Mar 1, 2015 · 1 comment
Closed

async.queue emits "saturated" event at wrong point #724

glenjamin opened this issue Mar 1, 2015 · 1 comment
Milestone

Comments

@glenjamin
Copy link

In the https://github.com/caolan/async#queue docs it says:

saturated - a callback that is called when the queue length hits the concurrency limit, and further tasks will be queued.

This is both correct & incorrect.

A queue has both a number of running() functions, and a queue of functions to run length(). The event is emitted when .length() === concurrency - whereas it should really be emitted when running() === concurrency.

Example:

var q = async.queue(function(){}, 2);
q.saturated = console.log.bind(console, "full");
q.push(1);
q.push(2);
// would expect "full" here
q.push(3);
q.push(4);
// but actually get "full" here
@aearly
Copy link
Collaborator

aearly commented Mar 1, 2015

You are correct, this is misleading. I fixed this as a side effect of other changes in #704

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants