lib/cloudtasker/worker.rb in cloudtasker-0.10.2 vs lib/cloudtasker/worker.rb in cloudtasker-0.11.rc1
- old
+ new
@@ -345,9 +345,16 @@
def execute_middleware_chain
self.perform_started_at = Time.now
Cloudtasker.config.server_middleware.invoke(self) do
begin
+ # Abort if arguments are missing. This may happen with redis arguments storage
+ # if Cloud Tasks times out on a job but the job still succeeds
+ if job_args.empty? && [0, -1].exclude?(method(:perform).arity)
+ raise(MissingWorkerArgumentsError, 'worker arguments are missing')
+ end
+
+ # Perform the job
perform(*job_args)
rescue StandardError => e
try(:on_error, e)
return raise(e) unless job_dead?