Well, I need to know even a vague shape of what's happening to be able to help - is it getting stuck in an infinite loop? Is it running out of memory? Without this sort of information, I won't be able to find the problem, and I don't have time to go through the entire codebase line by line.
Andrew On Mon, Jun 19, 2017 at 11:59 PM, Mattias Olsson <[email protected]> wrote: > There is none - all I can see is that the logging I placed att he very end > of the post_save method logs, but the logger.debug('SupportPingM > utation:post-save') that I placed after the .save() never runs. After the > channels message, the request is stale, and just freezes the server. > > > On Monday, 19 June 2017 16:33:16 UTC+2, Andrew Godwin wrote: >> >> What's the traceback when the code exits? There has to be some reason it >> stops there, and whatever your Python code is running in should be able to >> tell you why (traceback, status code, anything) >> >> Without that, I can't help, as it could be anything - your code or >> Django's. >> >> Andrew >> >> On Mon, Jun 19, 2017 at 7:21 AM, Mattias Olsson <[email protected]> >> wrote: >> >>> 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_vie >>> w(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.ge >>> t(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 [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at https://groups.google.com/group/django-users. >>> To view this discussion on the web visit https://groups.google.com/d/ms >>> gid/django-users/2ae1ece5-24ff-4754-9d21-b8207117292e%40googlegroups.com >>> <https://groups.google.com/d/msgid/django-users/2ae1ece5-24ff-4754-9d21-b8207117292e%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > 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 [email protected]. > To post to this group, send email to [email protected]. > 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/b12520a9-cc7e-4e3e-9962-7fa0e3b7c7e6%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/b12520a9-cc7e-4e3e-9962-7fa0e3b7c7e6%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. 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/CAFwN1upgWBT1LZy6SEtnNAbjhMiLdq%2BjGgXR0eGPYmsriSQ_wQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

