Repository navigation
Fix loader lifecycle and promise adapter selection - #82
Merged
Merged
Conversation
simPod
force-pushed
the
fix/promise-adapter-selection
branch
from
August 18, 2026 06:54
a96ff7c to
1dfdbfa
Compare
Contributor
Author
Blackfire Performance ProfileThe CLI workload creates and immediately awaits 2,000 temporary
This is an 18.5x wall-time improvement, 23.1x lower CPU time, and 71.2% lower The profile targets the loader lifecycle path changed in this PR. Xdebug and |
simPod
force-pushed
the
fix/promise-adapter-selection
branch
from
August 18, 2026 06:59
1dfdbfa to
2fac2bc
Compare
simPod
marked this pull request as draft
August 18, 2026 07:00
simPod
force-pushed
the
fix/promise-adapter-selection
branch
from
August 18, 2026 07:05
2fac2bc to
58a17b1
Compare
simPod
marked this pull request as ready for review
August 18, 2026 07:08
simPod
force-pushed
the
fix/promise-adapter-selection
branch
from
August 18, 2026 07:24
58a17b1 to
872c41f
Compare
simPod
force-pushed
the
fix/promise-adapter-selection
branch
from
August 18, 2026 07:57
872c41f to
b955119
Compare
Context: Dispatch can enqueue adapter callbacks after the pre-dispatch drain. Decision: Drain the owning adapter again after each queue dispatch. Consequences: No-argument await settles dispatched batches before returning.
mcg-web
approved these changes
Aug 18, 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.
Summary
await()returns.Lifecycle Decision
DataLoader::await()must dispatch queued loaders, settle the dispatched work,and use the adapter that owns the supplied promise. A strong global registry
retained every loader and its cache, and selecting the first loader could use
the wrong adapter in mixed-adapter applications.
Use weak references for loader instances and promise ownership. Retain a loader
strongly only while it has queued work, and remove it when dispatch starts. For
promises without recorded ownership, select a live adapter that recognizes the
promise before using a compatibility fallback. Drain the owning adapter after
dispatch so no-argument
await()does not return before callbacks settle. Aloader destructor cancels only its own queued promises.
Idle and dispatched loaders can be collected, inline temporary loaders remain
alive until dispatch, and queued work remains retained until the application
dispatches or cancels it.