Curl::Multi.http doesn't actually call perform when :max_connects >= number of requests #115

merged 5 commits into from May 18, 2012


None yet

2 participants

chuyeow commented May 10, 2012

This bug had me stumped when I was writing a Faraday adapter for Curb - I could never get the parallel requests test to pass!

I checked Curb's own tests but the tc_curl_multi.rb tests were still passing - it was only after I explicitly broke the tests (see e45a394) and the tests still passed that I realized the callbacks weren't actually being performed, so no assertions were actually run.

I traced the error back to 327e209, circa Curb 0.7.14 (it's still working on 0.7.14, but not in any versions after that). It's all due to the until urls_with_config.empty? check (I find until to be rather confusing).

Fixed the problem, plus added a test that covers the case where :max_connects < number of requests.

Note: You can leave out the commits I added to break and fix the tests (e45a394, fdea6ab) - I left them in for verification.

taf2 commented May 11, 2012

i'll try and review this one over this weekend.

chuyeow commented May 15, 2012

Hi Todd, I hate to be naggy but I hope you can merge this (this weekend maybe?) and publish a new gem release soon. I don't know how the bug slipped past so many releases so please verify my findings in case I've got it wrong. My guess is that most people are using Curl::Multi#add and Curl::Multi#perform instead of the simpler Curl::Multi.verb methods - or there're just not many people actually using Curb's multi interface.

@taf2 taf2 merged commit dceafcd into taf2:master May 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment