Permalink
Browse files

Remove hook mechanism.

  • Loading branch information...
1 parent acefab8 commit a40a167b083028ee96dc1e9e16ddefaa37cc272c @yetanothernguyen yetanothernguyen committed with betamatt May 27, 2011
Showing with 8 additions and 10 deletions.
  1. +0 −9 lib/delayed/backend/base.rb
  2. +8 −1 lib/delayed/worker.rb
@@ -76,15 +76,6 @@ def unlock
self.locked_at = nil
self.locked_by = nil
end
-
- def hook(name, *args)
- if payload_object.respond_to?(name)
- method = payload_object.method(name)
- method.arity == 0 ? method.call : method.call(self, *args)
- end
- rescue DeserializationError
- # do nothing
- end
def reschedule_at
payload_object.respond_to?(:reschedule_at) ?
View
@@ -146,7 +146,14 @@ def reschedule(job, time = nil)
end
def failed(job)
- job.hook(:on_permanent_failure)
+ begin
+ if job.payload_object.respond_to? :on_permanent_failure
+ say "Running on_permanent_failure hook"
+ job.payload_object.on_permanent_failure
+ end
+ rescue DeserializationError
+ # do nothing
+ end
self.class.destroy_failed_jobs ? job.destroy : job.update_attributes(:failed_at => Delayed::Job.db_time_now)
end

0 comments on commit a40a167

Please sign in to comment.