Module: ActiveJob::TrafficControl::Base
- Extended by:
- ActiveSupport::Concern, Forwardable
- Defined in:
- lib/active_job/traffic_control/base.rb
Instance Method Summary collapse
-
#cleaned_name ⇒ Object
convenience methods.
- #drop(reason) ⇒ Object
- #reenqueue(range, reason) ⇒ Object
Instance Method Details
#cleaned_name ⇒ Object
convenience methods
40 41 42 |
# File 'lib/active_job/traffic_control/base.rb', line 40 def cleaned_name self.class.cleaned_name end |
#drop(reason) ⇒ Object
51 52 53 54 |
# File 'lib/active_job/traffic_control/base.rb', line 51 def drop(reason) logger.info "Dropping #{self.class.name} due to #{reason}" ActiveSupport::Notifications.instrument "dropped.active_job", job: self, reason: reason end |
#reenqueue(range, reason) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/active_job/traffic_control/base.rb', line 44 def reenqueue(range, reason) later_delay = rand(range).seconds retry_job(wait: later_delay) logger.info "Re-enqueing #{self.class.name} to run in #{later_delay}s due to #{reason}" ActiveSupport::Notifications.instrument "re_enqueue.active_job", job: self, reason: reason end |