Navigation Menu

Skip to content

Commit

Permalink
Fix wrong use of timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 14, 2015
1 parent b6f6aa5 commit f3b471c
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions lib/droonga/client/connection/droonga-protocol/thread.rb
Expand Up @@ -82,18 +82,13 @@ def subscribe(message, options={}, &block)
receive_options = {
:timeout => timeout_seconds,
}
start = Time.new
sync = block.nil?
if sync
Enumerator.new do |yielder|
loop do
receiver.receive(receive_options) do |object|
yielder << object
end
if timeout_seconds and
Time.new - start > timeout_seconds
break
end
end
receiver.close
end
Expand All @@ -102,10 +97,6 @@ def subscribe(message, options={}, &block)
begin
loop do
receiver.receive(receive_options, &block)
if timeout_seconds and
Time.new - start > timeout_seconds
break
end
end
ensure
receiver.close
Expand Down

0 comments on commit f3b471c

Please sign in to comment.