lib/celluloid/evented_mailbox.rb in celluloid-0.15.2 vs lib/celluloid/evented_mailbox.rb in celluloid-0.16.0.pre
- old
+ new
@@ -40,13 +40,14 @@
def receive(timeout = nil, &block)
message = next_message(block)
until message
if timeout
+ # TODO: use hitimes/timers instead of Time.now
now = Time.now
wait_until ||= now + timeout
wait_interval = wait_until - now
- return if wait_interval < 0
+ raise(TimeoutError, "mailbox timeout exceeded", nil) if wait_interval <= 0
else
wait_interval = nil
end
@reactor.run_once(wait_interval)