Module: TResque::Worker
- Extended by:
- ActiveSupport::Concern
- Included in:
- DelayExecutionWorker
- Defined in:
- lib/tresque/worker.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#enqueued_options ⇒ Object
readonly
Returns the value of attribute enqueued_options.
Instance Method Summary collapse
- #initialize(options = {}) ⇒ Object
- #requeue ⇒ Object
- #requeue! ⇒ Object
- #requeue_delay_seconds ⇒ Object
- #worker_perform ⇒ Object
Instance Attribute Details
#enqueued_options ⇒ Object (readonly)
Returns the value of attribute enqueued_options.
200 201 202 |
# File 'lib/tresque/worker.rb', line 200 def @enqueued_options end |
Instance Method Details
#initialize(options = {}) ⇒ Object
201 202 203 |
# File 'lib/tresque/worker.rb', line 201 def initialize( = {}) @enqueued_options = .with_indifferent_access end |
#requeue ⇒ Object
214 215 216 217 218 219 220 221 |
# File 'lib/tresque/worker.rb', line 214 def requeue self.["run_at"] = nil delay = self.requeue_delay_seconds if delay > 0 self.["run_at"] = delay.seconds.from_now end self.class.enqueue(self.) end |
#requeue! ⇒ Object
223 224 225 226 |
# File 'lib/tresque/worker.rb', line 223 def requeue! requeue raise Resque::Job::DontPerform end |
#requeue_delay_seconds ⇒ Object
210 211 212 |
# File 'lib/tresque/worker.rb', line 210 def requeue_delay_seconds 1 end |
#worker_perform ⇒ Object
205 206 207 208 |
# File 'lib/tresque/worker.rb', line 205 def worker_perform to_call = self.[:action] || :work send(to_call) end |