Skip to content

Implement SDK request deduplication for identical concurrent calls #386

Description

@Kingsman-99

Overview

When multiple parts of the app call sdk.getInvoice(id) simultaneously for the same invoice, each triggers a separate RPC call. Add request deduplication so identical in-flight requests share a single network call.

Acceptance Criteria

  • Concurrent calls with identical method + args share one in-flight request (promise deduplication)
  • Deduplication window: the lifetime of the in-flight request — not a time window
  • Second caller receives the same resolved/rejected value as the first
  • Cache and deduplication are independent: deduplication applies even when cache is disabled
  • sdk.getDedupStats() returns { deduped: number, total: number } for observability
  • Deduplication opt-out per call: sdk.getInvoice(id, { dedupe: false }) for cases where fresh data is critical
  • Works correctly with the retry layer — a retried request starts a new dedup window

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions