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

Non-worker queues still process jobs. #89

Open
schmod opened this issue Mar 27, 2017 · 3 comments
Open

Non-worker queues still process jobs. #89

schmod opened this issue Mar 27, 2017 · 3 comments

Comments

@schmod
Copy link
Contributor

schmod commented Mar 27, 2017

The behavior of kue.createQueue({ worker: false }) is inconsistent with the documentation.

Currently, this flag only controls whether or not the queue will process jobs created with .every(). Queues created as "non-workers" will still process jobs in all other circumstances.

In the following example, the job gets processed, even though the queue has been marked as a "non-worker".

var Queue = kue.createQueue({ worker: false });

var job = Queue
    .createJob('myJob', data)
    .attempts(3)
    .backoff(backoff)
    .priority('normal');

Queue.schedule('3 seconds from now', job);

Queue.process('myJob', function (job, finalize) {
  console.log('Hello World!');
  finalize();
});
@lykmapipo
Copy link
Owner

@schmod I will appreciate a PR with the fix.

@schmod
Copy link
Contributor Author

schmod commented Mar 27, 2017

What do you think the appropriate behavior should be? Should Queue.process() throw an error if we try to call it on a non-worker, or should it simply not do anything?

@samhunta
Copy link
Contributor

samhunta commented Jun 25, 2017

My current setup contains micro services which I don't include the processing code for non workers. There's no good reason to have non-workers include that extra code anyway.

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

No branches or pull requests

3 participants