Skip Menu |

This queue is for tickets about the TheSchwartz CPAN distribution.

Report information
The Basics
Id: 60797
Status: resolved
Priority: 0/
Queue: TheSchwartz

People
Owner: Jeff.Fearn [...] gmail.com
Requestors: dmichellis [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.11



Subject: $job->declined() should allow a timestamp/timeout
Date: Fri, 27 Aug 2010 06:27:02 -0700 (PDT)
To: bug-TheSchwartz [...] rt.cpan.org
From: Deives Michellis <dmichellis [...] yahoo.com>
When declining a job, we could/should be able to say for how long the system should wait before trying it again. Waiting for one full hour is not very nice :( Currently, the only way I figured out is: $job->grabbed_until(time() + rand(5)); $job->declined(); $job->driver->update($job); Having to manually call grabbed_until and then an update on the database doesnt seem the best way to handle this. "declined" should do it for us, no? If there are proper ways to achieve such behaviour, please let me now. Thank you, and great job with TheSchwartz!
On Fri Aug 27 23:27:11 2010, dmichellis@yahoo.com wrote: Show quoted text
> When declining a job, we could/should be able to say for how long the > system should wait before trying it again. Waiting for one full hour > is not very nice :( > > Currently, the only way I figured out is: > > $job->grabbed_until(time() + rand(5)); > $job->declined(); > $job->driver->update($job); > > Having to manually call grabbed_until and then an update on the > database doesnt seem the best way to handle this. "declined" should do > it for us, no? > > If there are proper ways to achieve such behaviour, please let me now. > > Thank you, and great job with TheSchwartz! > > >
Hi, worker classes can override sub grab_for which is used to set the wait time, is this not sufficient? Cheers, Jeff.
After thinking about this I came to the conclusion that it would be nice to be able to have different behaviour between grab_for and decline. e.g. This would be handy where jobs take a long time to run, so you need a long grab_for, but you want to recheck declined jobs more often. Aded a prameter to declined that sets run_after to the supplied time, resets grab_for, updates job in DB. e.g. This has not changed: $job->declined(); This updates job & DB: $job->declined( time() + 2 ); To git@github.com:jfearn/TheSchwartz.git b83765d..ad065ca master -> master
A fix for this issue shipped in Version 1.11.