Skip to content

Commit

Permalink
Multi: yield fiber in perform only if requests are not finished yet
Browse files Browse the repository at this point in the history
  • Loading branch information
brainopia committed Oct 8, 2010
1 parent 9db40fb commit e0d9934
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/em-synchrony/em-multi.rb
Expand Up @@ -18,14 +18,18 @@ def add(name, conn)
@requests.push(conn)
end

def finished?
(@responses[:callback].size + @responses[:errback].size) == @requests.size
end

def perform
Fiber.yield
Fiber.yield unless finished?
end

protected

def check_progress(fiber)
if (@responses[:callback].size + @responses[:errback].size) == @requests.size
if finished?
succeed

# continue processing
Expand Down

0 comments on commit e0d9934

Please sign in to comment.