absinthe_graphql_ws
absinthe_graphql_ws copied to clipboard
Fix non-blocking query/mutation execution
Summary
- Fixed blocking behavior in query/mutation execution to allow concurrent operations per connection
- Simplified async handling by using
Task.asyncinstead of complexTask.Supervisorapproach - Added conditional support for
OpentelemetryProcessPropagator.Taskfor 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_mutationfunction to useTask.asyncfor non-blocking execution - Results are delivered asynchronously via PubSub broadcasts
- Added automatic detection and use of
OpentelemetryProcessPropagator.Taskwhen available for proper tracing context propagation - Removed unnecessary
QuerySupervisormodule 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