absinthe_graphql_ws icon indicating copy to clipboard operation
absinthe_graphql_ws copied to clipboard

Fix non-blocking query/mutation execution

Open jwaldrip opened this issue 4 months ago • 0 comments

Summary

  • Fixed blocking behavior in query/mutation execution to allow concurrent operations per connection
  • Simplified async handling by using Task.async instead of complex Task.Supervisor approach
  • Added conditional support for OpentelemetryProcessPropagator.Task for proper distributed tracing

Problem

Previously, queries and mutations were blocking, allowing only one query in progress per connection. This was incorrect as each query should be able to be fired and asynchronously listen for its response, following a similar flow to subscriptions.

Solution

  • Simplified the handle_query_or_mutation function to use Task.async for non-blocking execution
  • Results are delivered asynchronously via PubSub broadcasts
  • Added automatic detection and use of OpentelemetryProcessPropagator.Task when available for proper tracing context propagation
  • Removed unnecessary QuerySupervisor module that added complexity without benefit

Test Results

All tests pass, including the specific non_blocking_query_test.exs that verifies:

  • Multiple queries can execute concurrently
  • Fast queries complete before slow queries
  • All concurrent queries complete correctly

This brings query/mutation handling in line with how subscriptions work and matches what frontend transport layers expect.

🤖 Generated with Claude Code

jwaldrip avatar Sep 05 '25 18:09 jwaldrip