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

Already on GitHub? Sign in to your account

Fix cancelall method in server to delete all jobs of a failed type #115

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Contributor

databus23 commented Jun 10, 2013

The number of jobs returned by client.jobs.failed FAILURE_TYPE defaults to the first 25 of that type. To delete all jobs of one type at once we need to explicitly specify the number of failed jobs.

Fix cancelall method in server to delete all jobs of a failed type
The number of jobs returned by `client.jobs.failed FAILURE_TYPE` defaults to the first 25 of that type. To delete all jobs of one type at once we need to explicitly specify the number of failed jobs.
Owner

myronmarston commented Jun 10, 2013

Thanks, @databus23!

For perf reasons, I'm thinking that maybe this should use Qless::Client#bulk_cancel. Thoughts?

Contributor

databus23 commented Jun 10, 2013

Sure, I didn't notice that method. I'm just wondering if there is a maximum length for arguments when calling a redis lua script? I couldn't find anything about that in the documentation. But even if it is the case we could still pass chunks of jids to bulk_cancel in a loop.

Speaking of performance, it would also be beneficial to avoid the creation of all these Job objects just to map those right back to the plain jid.
How do you feel about doing something like

jids = JSON.parse(c._failed.call [],[data['type'], 0, count])['jobs'].map { |j| j['jid']}

in the cancelall of Qless::Server ?

Contributor

wr0ngway commented Oct 22, 2013

+1

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