Class: Dispatch::Rails::Transport::FlushSignal
- Inherits:
-
Object
- Object
- Dispatch::Rails::Transport::FlushSignal
- Defined in:
- lib/dispatch/rails/transport.rb
Overview
Sentinel pushed by #flush. The worker signals it when popped, which guarantees every event enqueued before it has been fully sent.
Instance Method Summary collapse
- #done! ⇒ Object
-
#initialize ⇒ FlushSignal
constructor
A new instance of FlushSignal.
- #wait(timeout) ⇒ Object
Constructor Details
#initialize ⇒ FlushSignal
Returns a new instance of FlushSignal.
18 19 20 |
# File 'lib/dispatch/rails/transport.rb', line 18 def initialize @latch = Queue.new end |
Instance Method Details
#done! ⇒ Object
22 23 24 |
# File 'lib/dispatch/rails/transport.rb', line 22 def done! @latch << true end |
#wait(timeout) ⇒ Object
26 27 28 |
# File 'lib/dispatch/rails/transport.rb', line 26 def wait(timeout) !@latch.pop(timeout: timeout).nil? end |