In flight request deduplication#105
Open
gloskull wants to merge 2 commits into
Open
Conversation
Deduplicate concurrent identical read requests so the SDK does not issue multiple network calls for the same access, membership, role, or guild lookup at the same time. - Added `inFlightRequests` Map to `GuildPassClient` to collapse identical requests. - Updated `withCache` to handle deduplication and promise cleanup. - Added unit tests to verify deduplication and error handling. - Updated documentation in `docs/sdk-guide.md`. Co-authored-by: gloskull <189399494+gloskull@users.noreply.github.com>
…70986552195156 Add in-flight request deduplication for identical reads
Author
|
Done with this issue. |
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.
Implemented in-flight request deduplication in the GuildPass SDK to prevent redundant network calls when multiple identical read operations are performed concurrently. This affects access checks, membership lookups, role retrievals, and guild lookups.
Key changes:
Introduced a private inFlightRequests map in GuildPassClient to track active promises by their cache key.
Refactored withCache to check for and return existing in-flight promises.
Guaranteed removal of in-flight entries upon settlement (success or failure) to prevent poisoning.
Added comprehensive tests in tests/deduplication.test.ts.
Documented the new behavior in docs/sdk-guide.md.
Fixed a pre-existing lint error in src/client/GuildPassClient.ts.
Closes #90