Skip to content

Fix RelationConnection's AsyncDataloader check - #5773

Open
drhops wants to merge 1 commit into
rmosolgo:masterfrom
drhops:fix-relation-connection-async-dataloader-guard
Open

drhops wants to merge 1 commit into
rmosolgo:masterfrom
drhops:fix-relation-connection-async-dataloader-guard

Conversation

@drhops

@drhops drhops commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

RelationConnection#async_dataloader? reads @context[:dataloader]. In a real query, that key is never set on the query context (the dataloader lives on the multiplex), so the lookup returns nil and the locks from #5708 and #5717 never engage. Under AsyncDataloader, edges and pageInfo still load the page twice.

The check now uses @context&.dataloader, which Query::Context resolves through the multiplex. This slipped through because both PRs' specs built the connection with a Hash context, where [:dataloader] works.

The specs now use a real query context via GraphQL::Query.new(...).context. Note a plain Hash context no longer satisfies the check.

…ock engages

RelationConnection#async_dataloader? read `context[:dataloader]`, but
Multiplex stores the dataloader on the multiplex context, not on the
query context a connection holds, so the key is nil for schemas that
`use GraphQL::Dataloader::AsyncDataloader` and the locks added in rmosolgo#5708
and rmosolgo#5717 never engaged. Read it through Query::Context#dataloader
instead, which falls back to the multiplex dataloader, and build the
Fiber specs' connections from a real query context so they exercise the
same path execution does.
@drhops drhops changed the title Fix RelationConnection's AsyncDataloader check so its single-flight lock engages Fix RelationConnection's AsyncDataloader check Oct 10, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant