[Feature] Honor requestTimeoutMs for event stream writes via wait_until deadline#3847
Open
kai-ion wants to merge 1 commit into
Open
[Feature] Honor requestTimeoutMs for event stream writes via wait_until deadline#3847kai-ion wants to merge 1 commit into
kai-ion wants to merge 1 commit into
Conversation
sbiscigl
reviewed
Jun 15, 2026
|
|
||
| std::unique_lock<std::mutex> lock{m_writeMutex}; | ||
| m_writeComplete.wait(lock, [this]() -> bool { return !m_writeInProgress; }); | ||
| if (m_requestTimeoutMs > 0) { |
Collaborator
There was a problem hiding this comment.
why are we checking this again if we already check in the constructor?
| size_t bufferLength, | ||
| long requestTimeoutMs) | ||
| : m_client{client}, m_buffer{bufferLength}, m_requestTimeoutMs{requestTimeoutMs} { | ||
| if (m_requestTimeoutMs > 0) { |
Collaborator
There was a problem hiding this comment.
so the c++ term for this would be a invariant, m_requestTimeoutMs cannot be less than 0. so you have two options:
- make
HttpWriteDataStreamBufa template. make requestTimeoutMs a template parameter, andstatic_asserton the size so that it is caught at compile time. - add a runtime assert on requestTimeoutMs, so on debug at runtime a assertion would be caught
sbiscigl
reviewed
Jun 15, 2026
| class AWS_CORE_API HttpWriteDataStreamBuf : public std::streambuf { | ||
| public: | ||
| explicit HttpWriteDataStreamBuf(const std::shared_ptr<Aws::Http::HttpClient>& client, size_t bufferLength = 8 * 1024); | ||
| explicit HttpWriteDataStreamBuf(const std::shared_ptr<Aws::Http::HttpClient>& client, size_t bufferLength = 8 * 1024, long requestTimeoutMs = 0); |
Collaborator
There was a problem hiding this comment.
how would 0/no timeout work here? seems like we would create a deadline that was right now
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.
Issue #, if available:
Description of changes:
This change adds a request-level deadline to HttpWriteDataStreamBuf.
When requestTimeoutMs > 0, a deadline is computed at construction
(now + requestTimeoutMs) and each SendBuffer call uses wait_until
instead of wait. If the deadline passes, the write fails immediately.
When requestTimeoutMs = 0 (default), behavior is unchanged.
Check all that applies:
Check which platforms you have built SDK on to verify the correctness of this PR.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.