Fix/http client bounded parallelism - #140
Merged
Merged
Conversation
- Implement sequential request dispatching with a queue-based approach to ensure requests are processed one at a time. - Add traffic logging feature to diagnose stalls and timeouts. - Improvements include: tracking request dispatch timing, null-safety check in queue_free(), fixed retry logic to properly manage current_request state, and a _log_traffic() helper for timestamped diagnostics.
…ncing Builds on #130 which correctly identified that several threaded HTTPRequests started in the same frame can stall and time out, but strict one-at-a-time dispatch also serialized emote and badge image downloads, which is what the parallel behaviour existed for. - BufferedHTTPClient gets `max_parallel_requests` (default 1, 0 = unlimited). Requests wait in `queued_requests` and move to `active_requests` in order as slots free up. API and OAuth clients stay sequential. - TwitchMediaLoader exports `max_parallel_downloads` (default 8) and applies it to its own client, so image downloads keep overlapping. - Retries keep their slot, rebind the RequestData (not the new node) and free the failed attempt's HTTPRequest. Exhausted retries and a failing HTTPRequest.request() now deliver an error response instead of hanging waiters and blocking the slot forever. - `request_timeout` is exported; the "request done" log line reports duration and retry count, replacing the separate `log_traffic` toggle. - Removes the unused `current_request`, `current_response_data`, `error_count` and `polling` fields. - Adds a GUT suite that drives the client against a loopback HTTPServer. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #130
Restore the old contract of BufferedHttpClient with configurable parallism. Best of both worlds.
closes #130