Repository navigation
Handle SimpleAsyncHTTPClient request timeout in heavy-loaded situation - #885
Conversation
The connect_timeout and request_timeout in HTTPRequest only matter when the _HTTPConnection get created. In heavy-loadded situation requests in SimpleAsyncHTTPClient may have already timeouted before they pop out from queue and get actual processed. This commit adds an timeout callback for every request appended to SimpleAsyncHTTPClient's request queue that cannot be processed immediately.
|
This is a good idea, but I wish it didn't add yet another timeout parameter. Is there ever a time when you'd want a different value for this new timeout (which I would call queue_timeout instead of async_timeout) and connect_timeout? The key difference between connect_timeout and request_timeout is that the former allows the request to be aborted before any potentially-expensive server-side work has begun, and this new timeout seems to fit in the same category. |
|
I've added the new timeout parameter because I'm afraid that adding extra logic to the current |
In a heavy-loaded situation when requests have to be queued, they may have waitted for a long time before pop out and get actual process. These requests become useless and already timeout indeed. The connect_timeout and request_timeout in
HTTPRequestand their timeout callback only matter when the _HTTPConnection get created. The SimpleAsyncHTTPClient handles requests ignoring their age in queue. As a result old requests get processed and block new request.I've added a
async_timeoutparam toHTTPRequestand corresponding timeout logic in theSimpleAsyncHTTPClient, hoping this would solve the problem.