It seems an obvious combination to use django's signalling architecture together with channels: a model is changed, a signal is fired, and a consumer is notified (via the signal handler and channel layer) to update a client via, for instance, a WebSocket.
However, very often a model is updated as part of a transaction, and django's pre_save and post_save signals are sent in the middle of the transaction, meaning the change you notify the client about may never happen at all. Even more annoyingly, when you send the information across the channel layer you're looking at the database from another thread and, since the transaction is not complete, you can't get the new data.
django.db.transaction.on_commit provides a way to schedule (part of) the signal handler to run after the transaction is done, providing a workaround, but this seems to be such an obvious problem with absolutely no documentation or stackoverflow chatter that I'm a bit perturbed (one can of course find discussions about each pair of the three mentioned topics!) So is this architecture: signal -> handler -> channel layer -> consumer [ -> client ] actually a bad one? Is there some alternative that doesn't involve wrapping each handler in a on_commit hook, or is there some common idiom for doing that an DRY way?