Class: Hawkei::Processor::Async
- Inherits:
-
Object
- Object
- Hawkei::Processor::Async
- Defined in:
- lib/hawkei/processor/async.rb
Instance Method Summary collapse
- #enqueue(attributes) ⇒ Object
-
#initialize ⇒ Async
constructor
A new instance of Async.
Constructor Details
#initialize ⇒ Async
Returns a new instance of Async.
5 6 7 8 9 10 11 12 13 |
# File 'lib/hawkei/processor/async.rb', line 5 def initialize @queue = Queue.new @state_worker = Concurrent::AtomicBoolean.new(true) @worker = Worker.new(@queue, @state_worker) at_exit do shutdown_worker if worker_running? end end |
Instance Method Details
#enqueue(attributes) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/hawkei/processor/async.rb', line 15 def enqueue(attributes) ensure_worker_running @queue << attributes true end |