Method: ZMQMachine::Deferrable#timeout
- Defined in:
- lib/zm/deferrable.rb
#timeout(seconds, *args) ⇒ Object
Setting a timeout on a Deferrable causes it to go into the failed state after the Timeout expires (passing no arguments to the object’s errbacks). Setting the status at any time prior to a call to the expiration of the timeout will cause the timer to be cancelled.
166 167 168 169 170 171 172 173 |
# File 'lib/zm/deferrable.rb', line 166 def timeout seconds, *args cancel_timeout me = self # we use milliseconds, not seconds, so adjust the passed in time seconds *= 1000 @deferred_timeout = ZMQMachine::Timers.add_oneshot seconds {me.fail(*args)} end |