Class: Temporalio::Worker::Reactor Private
- Inherits:
-
Object
- Object
- Temporalio::Worker::Reactor
- Defined in:
- lib/temporalio/worker/reactor.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A shared async reactor.
This class allows multiple workers to access the same Async reactor without forcing the SDK users to wrap their execution in an Async block. This is handled using a queue that is polled from within a running Async reactor, so all the blocks end up being executed within it.
Instance Method Summary collapse
- #async(&block) ⇒ Object private
-
#initialize ⇒ Reactor
constructor
private
A new instance of Reactor.
Constructor Details
#initialize ⇒ Reactor
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Reactor.
14 15 16 17 18 |
# File 'lib/temporalio/worker/reactor.rb', line 14 def initialize @queue = Queue.new @thread = nil @mutex = Mutex.new end |
Instance Method Details
#async(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 23 |
# File 'lib/temporalio/worker/reactor.rb', line 20 def async(&block) ensure_reactor_thread queue << block end |