Module: Resque::SilenceDone
- Defined in:
- lib/resque/silence_done.rb
Class Method Summary collapse
Instance Method Summary collapse
- #perform_no_log(job) ⇒ Object
-
#work_one_job_no_log(job = nil, &block) ⇒ Object
unregister_worker rescue Exception => exception return if exception.class == SystemExit && !@child && run_at_exit_hooks log_with_severity :error, “Failed to start worker : #exceptionexception.inspect” unregister_worker(exception) end.
Class Method Details
.included(receiver) ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/resque/silence_done.rb', line 61 def self.included(receiver) receiver.class_eval do alias work_one_job_with_log work_one_job alias work_one_job work_one_job_no_log alias perform_with_log perform alias perform perform_no_log end end |
Instance Method Details
#perform_no_log(job) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/resque/silence_done.rb', line 3 def perform_no_log(job) begin if fork_per_job? reconnect run_hook :after_fork, job end job.perform rescue Object => e report_failed_job(job,e) else # log_with_severity :info, "done: #{job.inspect}" ensure yield job if block_given? end end |
#work_one_job_no_log(job = nil, &block) ⇒ Object
unregister_worker rescue Exception => exception
return if exception.class == SystemExit && !@child && run_at_exit_hooks
log_with_severity :error, "Failed to start worker : #{exception.inspect}"
unregister_worker(exception)
end
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/resque/silence_done.rb', line 41 def work_one_job_no_log(job = nil, &block) return false if paused? return false unless job ||= reserve working_on job procline "Processing #{job.queue} since #{Time.now.to_i} [#{job.payload_class_name}]" #log_with_severity :info, "got: #{job.inspect}" job.worker = self if fork_per_job? perform_with_fork(job, &block) else perform(job, &block) end done_working true end |