mercurius-js / mercurius

Implement GraphQL servers and gateways with Fastify
https://mercurius.dev/
MIT License
2.34k stars 234 forks source link

Question: Subscription Gateway caching? #488

Open darrenfurr opened 3 years ago

darrenfurr commented 3 years ago

Does the federation gateway cache subscriptions? I'm seeing issues where if I add a new field to a schema & deploy that graphql instance. The gateway doesn't appear to return the result. It just returns null.

I have to restart the gateway. Am I missing a setting somewhere to disable this?

Thanks! -Darren

mcollina commented 3 years ago

It should update automatically. Could you upload a full example?

darrenfurr commented 3 years ago

@mcollina - working on getting you an example. Sorry for the delay

darrenfurr commented 3 years ago

@mcollina - After some research...I tracked this issue down. It is not the gateway.

I migrated our Apollo server(s) with subscriptions to mercurius with federation, so the issue is with the withFilter implementation in mercurius.

The Apollo implementation returns an asyncIterator which we use with KafkaPubSub

I pulled in the graphql-subscription package from Apollo & used their withFilter implementation & it works correctly.

Maybe this is a known issue? If you would like - I can setup a demo repo with examples

mcollina commented 3 years ago

The best approach would be to send a PR to fix our implementation!

ramonmulia commented 2 years ago

hey @darrenfurr could you create a demo repo with some examples?

darrenfurr commented 2 years ago

@ramonmulia - We ran into a number of issues using the subscription gateway + load balancing. We've moved away from using the subscription gateway & just have our clients connect directly to the subscription service.