Permalink
Browse files

minor refactoring

  • Loading branch information...
1 parent 0d10f92 commit 7e97ca884d928d4fb3b19affdab6007665cf66bc Kim Altintop committed Aug 6, 2009
Showing with 2 additions and 3 deletions.
  1. +2 −3 lib/gearman/taskset.rb
View
5 lib/gearman/taskset.rb
@@ -225,7 +225,7 @@ def read_packet(sock, timeout=nil)
# Wait for all tasks in the set to finish.
#
# @param timeout maximum amount of time to wait, in seconds
- def wait(timeout=1)
+ def wait(timeout = 1)
end_time = if timeout
Time.now.to_f + timeout
else
@@ -234,11 +234,10 @@ def wait(timeout=1)
while not @tasks_in_progress.empty?
remaining = if end_time
- end_time - Time.now.to_f
+ (t = end_time - Time.now.to_f) > 0 ? t : 0
else
nil
end
- remaining = 0 if remaining != nil && remaining < 0
ready_socks = IO::select(@sockets.values, nil, nil, remaining)
if not ready_socks or not ready_socks[0]

0 comments on commit 7e97ca8

Please sign in to comment.