Module: Conflow::Worker
- Defined in:
- lib/conflow/worker.rb
Overview
It adds #perform method which accepts two parameters: flow_id and job_id and a block. Block yields Class name and parameters. If block returns without errors, job is considered finished.
Instance Method Summary collapse
-
#perform(flow_id, job_id) {|worker_type, params| ... } ⇒ Object
Result of the block execution.
Instance Method Details
#perform(flow_id, job_id) {|worker_type, params| ... } ⇒ Object
Returns result of the block execution.
25 26 27 28 29 30 31 32 |
# File 'lib/conflow/worker.rb', line 25 def perform(flow_id, job_id) job = Conflow::Job.new(job_id) flow = Conflow::Flow.find(flow_id) flow.start(job) yield(job.worker_type, job.params).tap { |result| flow.finish(job, result) } end |