fix: preserve recentlyHandledRequestsCache across watchdog reset to p…#3505
Open
dearlordylord wants to merge 1 commit intoapify:masterfrom
Open
fix: preserve recentlyHandledRequestsCache across watchdog reset to p…#3505dearlordylord wants to merge 1 commit intoapify:masterfrom
dearlordylord wants to merge 1 commit intoapify:masterfrom
Conversation
…revent handled request refetch
Contributor
|
Hi @dearlordylord, I did not examine this carefully yet. Do I understand it right that the race condition you describe happens because after resetting the queue here? |
Author
Yes exactly. Specifically: it's not the whole _reset() that's the problem, it's the recentlyHandledRequestsCache.clear() inside it. The other clears (queueHeadIds, counters, requestCache) are fine and serve the unsticking purpose. |
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.
…revent handled request refetch
Why removing the clear is safe
recentlyHandledRequestsCache is only populated in two places, both after server confirmation:
No code path adds a pending/unhandled request to this cache. Preserving it across reset cannot cause a stuck queue because every entry genuinely represents a handled request.
Additionally fetchNextRequest has a secondary server-side guard: even if a request somehow passes the cache filter, getRequest() checks request.handledAt and returns null. But relying solely on this is wasteful (unnecessary server roundtrips)
The cache is LRU-bounded at 1000 entries, no memory concern from preserving it.