Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

async.queue pause/resume problem #508

Closed
i3fox opened this issue Apr 14, 2014 · 3 comments
Closed

async.queue pause/resume problem #508

i3fox opened this issue Apr 14, 2014 · 3 comments

Comments

@i3fox
Copy link

i3fox commented Apr 14, 2014

Async v.0.7.0

In the async.queue I found an issue related to restart after a pause (resume) and I try to fix.
It's not simple to explain, please follow these steps:

  1. for concurrency tasks are in execution
  2. I pause the queue and wait for the execution of tasks finishes
  3. I resume queue
  4. Queue restarts but concurrency does not work: only one task is running.

Below you find
a) Example of problem
b) My purpose to fix

please, let me known if it's ok.
Best regards
Fox

Example of problem:

var async = require("async");
var q = async.queue(function (task, callback) {
    console.log('hello ' + task.name);
    setTimeout(function() {
      //console.log('bye ' + task.name);
      callback();
    }, 2000);
}, 5);

q.pause();
q.push({name: '1'});
q.push({name: '2'});
q.push({name: '3'});
q.push({name: '4'});
q.push({name: '5'});
q.push({name: '6'});
q.push({name: '7'});
q.push({name: '8'});
q.push({name: '9'});
q.push({name: '10'});

setTimeout(function () {
  q.resume();
}, 2500);

My purpose to fix at row number 806 and next

            pause: function () {
                if (q.paused === true) { return; }
                q.paused = true;
                // modify
                // before
                //q.process();
            },
            resume: function () {
                if (q.paused === false) { return; }
                q.paused = false;
                // modify
                // before
                //q.process();
                // after
                _each(q.tasks, function(task) {
                    async.setImmediate(q.process);
                });
            }
@aearly
Copy link
Collaborator

aearly commented Apr 14, 2014

Can you submit this as an actual pull request? That way CI can test it automatically. A test case that reproduces the error would also be extremely helpful.

@aearly
Copy link
Collaborator

aearly commented May 21, 2015

Moving discussion to #512.

@aearly aearly closed this as completed May 21, 2015
@ORESoftware
Copy link
Contributor

was this resolved?

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

No branches or pull requests

3 participants