fix(cache): preserve 304 response event order with async stores - #5797
Open
marcopiraccini wants to merge 7 commits into
Open
marcopiraccini wants to merge 7 commits into
marcopiraccini wants to merge 7 commits into
Conversation
marcopiraccini
marked this pull request as draft
September 10, 2026 08:41
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5797 +/- ##
==========================================
+ Coverage 93.52% 93.57% +0.05%
==========================================
Files 110 110
Lines 39414 39853 +439
==========================================
+ Hits 36863 37294 +431
- Misses 2551 2559 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
marcopiraccini
marked this pull request as ready for review
September 10, 2026 09:26
metcoder95
reviewed
Sep 10, 2026
| // when stream is full stop writing until we get a 'drain' event | ||
| if (full) { | ||
| break | ||
| return new Promise((resolve) => { |
Member
There was a problem hiding this comment.
I'd prefer if we use a callback instead of creating a new Promise; in that way, regardless of the nature, we minimize overhead as well keep things a bit consistent.
Member
There was a problem hiding this comment.
I don't think it's the contract.
mcollina
requested changes
Sep 11, 2026
| // when stream is full stop writing until we get a 'drain' event | ||
| if (full) { | ||
| break | ||
| return new Promise((resolve) => { |
Member
There was a problem hiding this comment.
I don't think it's the contract.
|
|
||
| onResponseData (controller, chunk) { | ||
| if (this.#pending304) { | ||
| this.#pending304 = this.#pending304.then(() => this.onResponseData(controller, chunk)) |
Member
There was a problem hiding this comment.
this create an infinite chain of pending promises
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
Contributor
Author
|
@mcollina PTAL |
Member
|
@metcoder95 PTAL |
metcoder95
approved these changes
Sep 17, 2026
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.
This relates to...
N/A
Rationale
A cache revalidation can receive a 304 before an asynchronous store has returned the cached response. The 304 itself has no body, but the cached body must be replayed before downstream receives the response end.
Changes
Features
N/A
Bug Fixes
Breaking Changes and Deprecations
N/A
Status