Class: Backburner::Workers::Simple
- Inherits:
-
Backburner::Worker
- Object
- Backburner::Worker
- Backburner::Workers::Simple
- Defined in:
- lib/backburner/workers/simple.rb
Instance Attribute Summary
Attributes inherited from Backburner::Worker
Instance Method Summary collapse
-
#prepare ⇒ Object
Used to prepare job queues before processing jobs.
-
#start ⇒ Object
Starts processing new jobs indefinitely.
Methods inherited from Backburner::Worker
enqueue, #handle_failure_for_job, #initialize, #process_tube_names, #shutdown, start, #work_one_job
Methods included from Logger
included, #job_started_at, #log_error, #log_info, #log_job_begin, #log_job_end, #logger
Methods included from Helpers
#classify, #constantize, #dasherize, #exception_message, #expand_tube_name, included, #queue_config, #resolve_max_job_retries, #resolve_priority, #resolve_respond_timeout, #resolve_retry_delay, #resolve_retry_delay_proc
Constructor Details
This class inherits a constructor from Backburner::Worker
Instance Method Details
#prepare ⇒ Object
Used to prepare job queues before processing jobs. Setup beanstalk tube_names and watch all specified tubes for jobs.
11 12 13 14 15 |
# File 'lib/backburner/workers/simple.rb', line 11 def prepare self.tube_names.map! { |name| (name) }.uniq! log_info "Working #{tube_names.size} queues: [ #{tube_names.join(', ')} ]" # self.connection.tubes.watch!(*self.tube_names) end |
#start ⇒ Object
Starts processing new jobs indefinitely. Primary way to consume and process jobs in specified tubes.
23 24 25 26 |
# File 'lib/backburner/workers/simple.rb', line 23 def start prepare loop { work_one_job } end |