Skip to content

feat: ensure synchronization of dataloader load calls when batching i… - #2203

Merged
samuelAndalon merged 1 commit into
10.x.xfrom
feat/10.x.x/ensure-synchronization-dataloader-load
Jul 28, 2026
Merged

feat: ensure synchronization of dataloader load calls when batching i…#2203
samuelAndalon merged 1 commit into
10.x.xfrom
feat/10.x.x/ensure-synchronization-dataloader-load

Conversation

@samuelAndalon

Copy link
Copy Markdown
Contributor

📝 Description

cherry-pick #2202

…s disabled and caching enabled (#2202)

### 📝 Description

graphql-java/java-dataloader#241

java-dataloader 6 removed synchronization from DataLoader.load(). For
cached loaders with batching disabled, concurrent calls using the same
key can both observe a cache
miss and invoke the underlying loader before either future is cached.
This results in duplicate downstream requests even though callers
ultimately receive the same cached
  future.

  This change:

- Adds an internal SynchronizedDataLoader wrapper that synchronizes both
load overloads.
- Applies the wrapper only when caching is enabled and batching is
disabled.
- Adds a coroutine-based regression test verifying concurrent same-key
loads invoke the underlying loader once.

Co-authored-by: Samuel Vazquez <samvazquez@expediagroup.com>
@samuelAndalon
samuelAndalon merged commit 34945b3 into 10.x.x Jul 28, 2026
1 check passed
@samuelAndalon
samuelAndalon deleted the feat/10.x.x/ensure-synchronization-dataloader-load branch July 28, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant