You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#283 : Fixes CPU busy loop when using request_multiple.
See #284 for background information
This will require more testing across various libcurl versions.
I doubt that the timeout is necessary for curl_multi_select
(calls select() if it can),
but leaving in one just in case of bugs, so that it will end.
- Haven't thoroughly checked for relevant libcurl bugs.
Asynchronously wait for events with a short timeout if CURLM_CALL_MULTI_PERFORM
fails. Use shorter timeouts when the total time elapsed so far is
shorter. Make the largest possible manual usleep 2ms.
// For a small fraction of slow requests, curl_multi_select will busy loop and return immediately with no indication of error (it returns 0 immediately with/without setting curl_multi_errno).
225
+
// (https://github.com/rmccue/Requests/pull/284)
226
+
// To mitigate this, add our own sleep if curl returned but no requests completed (failing or succeeding)
227
+
// - The amount of time to sleep is the smaller of 1ms or 10% of total time spent waiting for curl requests
228
+
// (10% was arbitrarily chosen to slowing down requests that would normally take less than 1 millisecond)
229
+
// - The amount of time that was already spent in curl_multi_exec+curl_multi_select in the previous request is subtracted from that.
230
+
// (E.g. if curl_multi_select already slept for 2 milliseconds, curl_multi_select might be operating normally)
0 commit comments