lib/em-http/multi.rb in em-http-request-0.2.6 vs lib/em-http/multi.rb in em-http-request-0.2.7
- old
+ new
@@ -32,20 +32,20 @@
@requests = []
@responses = {:succeeded => [], :failed => []}
end
def add(conn)
+ @requests.push(conn)
+
conn.callback { @responses[:succeeded].push(conn); check_progress }
conn.errback { @responses[:failed].push(conn); check_progress }
-
- @requests.push(conn)
end
protected
# invoke callback if all requests have completed
def check_progress
succeed if (@responses[:succeeded].size + @responses[:failed].size) == @requests.size
end
end
-end
\ No newline at end of file
+end