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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

databus23
Copy link
Contributor

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.

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.
@myronmarston
Copy link
Contributor

Thanks, @databus23!

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

@databus23
Copy link
Contributor Author

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 ?

@wr0ngway
Copy link
Contributor

+1

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

Successfully merging this pull request may close these issues.

3 participants