Skip to content

Simplify GraphQL subscription load balancing

Matthias Käppler requested to merge 402999-simplify-graphql-lb into master

What does this MR do and why?

Simplifies GraphQL subscription load balancing. This is a refactor and not user facing.

We introduced database load balancing for GraphQL subs in !117678 (merged). In that MR we hooked into the GraphQL-ruby serializer to inject custom payload through Redis PubSub so readers know how far they are behind the writer.

I found a better way to wrap event payloads that does not involve overriding the internal serializer, but simply wraps the original object in a Hash. The bit I missed before was that graphql-ruby is still able to resolve entities recursively this way. This also prepares this class for future extensions that will require a custom implementation of execute_update and execute_all anyway, such as instrumenting query executions, which we are looking to do in #402717.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #402999 (closed)

Edited by Matthias Käppler

Merge request reports

Loading