graphene-subscriptions icon indicating copy to clipboard operation
graphene-subscriptions copied to clipboard

How to make signals trigger subscriptions across multiple dynos/schedulers

Open mukluk opened this issue 5 years ago • 2 comments

First of, I LOVE your library and have been able to perfectly implement it in my project. I have been planning on scaling up though and am having some thoughts on signals originating from multiple cpus/dynos or perhaps even firing them from a scheduler. Is there a way to have signals trigger subscriptions as per the aforementioned requirements? I was thinking of firing them across channels, but it seems rather complicated and I am still fairly new to python.

What are your thoughts? Help is greatly appreciated. Thank you in advance!

mukluk avatar May 13 '20 04:05 mukluk

Hey @mukluk! Awesome, glad you like it 😊

graphene-subscriptions actually handles sending events to multiple app instances using Channel Layers automatically. If you use the built-in post_save_subscription and post_delete_subscription signals, an event will be sent via Channel Layers so that all instances with active Subscription connections receive it and send the data to the client. If you're using Custom Events this is also handled automatically.

Does that help?

jaydenwindle avatar May 13 '20 13:05 jaydenwindle

Thank you so much for the quick response.

That's good to know. I was running a Heroku Scheduler to run some updating tasks and the signals weren't triggering graphene-subscriptions, so I assumed that they weren't being sent over channels, but this may be a separate issue.

mukluk avatar May 13 '20 17:05 mukluk