Class: Doctrine::Worker
- Inherits:
-
Object
- Object
- Doctrine::Worker
- Defined in:
- lib/doctrine/worker.rb
Overview
- public
Instance Method Summary collapse
-
#initialize(queue:, runner:) ⇒ Worker
constructor
A new instance of Worker.
-
#run ⇒ Object
[public].
Constructor Details
#initialize(queue:, runner:) ⇒ Worker
Returns a new instance of Worker.
7 8 9 10 |
# File 'lib/doctrine/worker.rb', line 7 def initialize(queue:, runner:) @queue = queue @runner = runner end |
Instance Method Details
#run ⇒ Object
- public
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/doctrine/worker.rb', line 14 def run until @queue.closed? if (run = @queue.pop) begin @runner.starting(run) run.perform rescue => error run.errored(error) ensure @runner.finished(run) end end end end |