From 6243a728d67536956ce07fe7891500a54208aa07 Mon Sep 17 00:00:00 2001 From: databus23 Date: Mon, 10 Jun 2013 15:44:07 +0300 Subject: [PATCH] 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. --- lib/qless/server.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/qless/server.rb b/lib/qless/server.rb index 13b5605f..ad8d665c 100755 --- a/lib/qless/server.rb +++ b/lib/qless/server.rb @@ -427,7 +427,8 @@ def strftime(t) if data["type"].nil? halt 400, "Neet type" else - return json(client.jobs.failed(data["type"])['jobs'].map do |job| + count = client.jobs.failed[data["type"]] + return json(client.jobs.failed(data["type"], 0, count)['jobs'].map do |job| job.cancel() { :id => job.jid } end)