lib/sidekiq/job_retry.rb in sidekiq-6.0.1 vs lib/sidekiq/job_retry.rb in sidekiq-6.0.2

- old
+ new

@@ -72,21 +72,22 @@ end # The global retry handler requires only the barest of data. # We want to be able to retry as much as possible so we don't # require the worker to be instantiated. - def global(msg, queue) + def global(jobstr, queue) yield rescue Handled => ex raise ex rescue Sidekiq::Shutdown => ey # ignore, will be pushed back onto queue during hard_shutdown raise ey rescue Exception => e # ignore, will be pushed back onto queue during hard_shutdown raise Sidekiq::Shutdown if exception_caused_by_shutdown?(e) + msg = Sidekiq.load_json(jobstr) if msg["retry"] attempt_retry(nil, msg, queue, e) else Sidekiq.death_handlers.each do |handler| handler.call(msg, e) @@ -104,21 +105,22 @@ # # Note that any exception from the block is wrapped in the Skip # exception so the global block does not reprocess the error. The # Skip exception is unwrapped within Sidekiq::Processor#process before # calling the handle_exception handlers. - def local(worker, msg, queue) + def local(worker, jobstr, queue) yield rescue Handled => ex raise ex rescue Sidekiq::Shutdown => ey # ignore, will be pushed back onto queue during hard_shutdown raise ey rescue Exception => e # ignore, will be pushed back onto queue during hard_shutdown raise Sidekiq::Shutdown if exception_caused_by_shutdown?(e) + msg = Sidekiq.load_json(jobstr) if msg["retry"].nil? msg["retry"] = worker.class.get_sidekiq_options["retry"] end raise e unless msg["retry"] @@ -250,10 +252,10 @@ rescue +"!!! ERROR MESSAGE THREW AN ERROR !!!" end def compress_backtrace(backtrace) - serialized = Marshal.dump(backtrace) + serialized = Sidekiq.dump_json(backtrace) compressed = Zlib::Deflate.deflate(serialized) Base64.encode64(compressed) end end end