Hi all, I'm having some issues with integrating automatic group messaging based on a post save signal from Django models.
I'm currently running a Graphene environment (graphene-python.org) to support a webapp running React/Relay. In this setup we're performing *Mutations* which will manipulate data, and return a payload based on the data that was mutated. During a data mutation process I'm saving a model, which triggers a post_save, which in turn seems to hijack the process and terminate it, before the mutation can return its payload. I have a simple JsonWebsocketConsumer to handle my connections. class MyConsumers(JsonWebsocketConsumer): channel_session_user = True strict_ordering = True method_mapping = { "websocket.connect": "connect", "websocket.receive": "receive", "websocket.disconnect": "disconnect", } def connection_groups(self, **kwargs): return ["all-clients", ] def connect(self, message, **kwargs): # Accepts connections and returns {'Accepted': Trie} subscription_manager.SubscriptionManager.connect_endpoint(message) def receive(self, content, **kwargs): # Registers groups and stores data in redis cache. subscription_manager.SubscriptionManager.receive_endpoint(content) def disconnect(self, message, **kwargs): ... A mutation comes in through urls as a normal http-request (through the /graphql match): urlpatterns = [ ... url(r'^graphql', csrf_exempt(GraphQLView.as_view(graphiql=settings.DEBUG))), url(r'^admin/', admin.site.urls), url(r'^support/', include(support_urls)), url(r'^django-rq/', include('django_rq.urls')), ] The routing is as simple as can be: subscription_routing = [ route_class(consumers.QuantumConsumers) ] channel_routing = [ include(subscription_routing, path=r"^/ws/subscriptions"), ] The post save is attached through a util on each model: class Ping(models.Model): support_session = models.OneToOneField(SupportSession, related_name="ping") client_ping = models.DateTimeField(...) support_ping = models.DateTimeField(...) # Sets up a post_save ModelSignalReceiver.connect_receivers(Ping) Finally, a mutation is a simple method that executes a save: class PingMutation(graphene.ClientIDMutation): class Input: support_session_id = graphene.ID() ping = graphene.Field(PingNode) @classmethod def mutate_and_get_payload(cls, args, context, info): session_id = from_global_id(args.get('support_session_id'))[1] pings = support_models.Ping.objects.get(support_session__id=session_id) pings.support_last_ping = datetime.datetime.now() # I can see this debug message, before the save. logger.debug('SupportPingMutation:pre-save') # Will trigger the signal... pings.save() # The code never reaches this point. logger.debug('SupportPingMutation:post-save') return cls(ping=pings) Any ideas on why the process gets hijacked? Should the post_save which triggers a consumer response not be dispatched? Thank you in advance. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2ae1ece5-24ff-4754-9d21-b8207117292e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.