-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kgo: allow clients to cancel requests
Previously, if the client got to the point of writing a request, it would not be possible to cancel the request. This now writes and reads in goroutines, and allows for killing requests (with immediate deadlines) if a context closes early. Importantly, this also ensures that client shutdown or broker migration cancels requests as well. Previously, a client shutting down did not actually kill an active write / read. We used to just close the request channel and trust that things would eventually close; the new logic kills writes if the client's context closes. Also even more importantly, this new logic allows for a dying broker connection, as well as the client closing, to quit the throttle waiting. Previously, a throttle was only quit if the request's context quit. This updates the read and write hooks to track the exact amount of bytes written, and to more correctly count bytes read. The throttle logic has been fixed to call the throttle hooks for pre-2.0.0 (i.e, !throttlesAfterResp). I accidentally broke the logic when introducing throttlesAfterResp (thanks @akesle for noticing this).
- Loading branch information
Showing
3 changed files
with
123 additions
and
72 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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