From ea929cb87b3464800629e1279859f81033bf4e30 Mon Sep 17 00:00:00 2001 From: anil galve Date: Tue, 11 Oct 2011 23:42:51 +0530 Subject: [PATCH] handled issue of worker process being killed while creating handler and loading yaml for it --- lib/delayed/job.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/delayed/job.rb b/lib/delayed/job.rb index 2dfa0bba1..1a7557c3a 100644 --- a/lib/delayed/job.rb +++ b/lib/delayed/job.rb @@ -214,7 +214,7 @@ def self.work_off(num = 100) # Moved into its own method so that new_relic can trace it. def invoke_job - payload_object.perform + payload_object.perform if payload_object end private @@ -227,13 +227,13 @@ def deserialize(source) handler_class = $1 end attempt_to_load(handler_class || handler.class) - handler = YAML.load(source) + handler = YAML.load(source) rescue nil end return handler if handler.respond_to?(:perform) raise DeserializationError, - 'Job failed to load: Unknown handler. Try to manually require the appropiate file.' + 'Job failed to load: Unknown handler. Try to manually require the appropiate file.' if handler rescue TypeError, LoadError, NameError => e raise DeserializationError, "Job failed to load: #{e.message}. Try to manually require the required file."