This code will do it, but it kinda sucks, since its doing double sql selects.
class CommentInstantEmailsWorker < BackgrounDRb::MetaWorker
set_worker_name :comment_instant_emails_worker
def check_for_enqueued_tasks_with_repeat
while BdrbJobQueue.count(:conditions =>
[" worker_name = ? AND taken = ? AND scheduled_at <= ? ",
worker_name.to_s, 0, Time.now.utc ]) > 0
check_for_enqueued_tasks_without_repeat
end
end
alias_method_chain :check_for_enqueued_tasks, :repeat
...
0 comments:
Post a Comment