Module: Fargo::Supports::Timeout
- Included in:
- Client
- Defined in:
- lib/fargo/supports/timeout.rb
Instance Method Summary collapse
Instance Method Details
#timeout_response(timeout, succeed_subscription) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fargo/supports/timeout.rb', line 5 def timeout_response timeout, succeed_subscription thread = Thread.current subscribed_block = lambda do |*args| thread.wakeup if succeed_subscription.call(*args) end subscribe &subscribed_block yield sleep timeout unsubscribe &subscribed_block end |