lib/muxer/multiplexer.rb in muxer-0.3.2 vs lib/muxer/multiplexer.rb in muxer-0.3.3

- old
+ new

@@ -70,14 +70,17 @@ # executes the actual event loop that manages creating, sending, # and processing the finished / timed out web requests # # @return [Hash] Keys are :succeeded, :failed def execute - @responses = {succeeded: [], failed: [], pending: [], succeeded_by_id: {}} + @responses = {succeeded: [], failed: [], pending: [], succeeded_by_id: {}, requests_by_id: {}} @start = Time.now EventMachine.run do requests.each do |request| @responses[:pending] << request.process! + if request.id + @responses[:requests_by_id][request.id] = request + end end EM::PeriodicTimer.new(0.001) do process_requests end \ No newline at end of file