A distributed task processing framework for Django built on top of the Postgres NOTIFY/LISTEN protocol.
Rather than relying on signals and celery, we may want to consider borrowing a pattern from the land of Postgres: Triggers and NOTIFY/LISTEN. The library django-pgpubsub offers a django application layer abstraction of this pattern. We can refactor our above solution using django-pgpubsub to look as follows:
Write Postgres triggers for your Django models
Note that have now ditched our post_save signal from the previous solution. As we pointed out, signals can easily be missed. Instead, we are using a Postgres trigger : defining the listener as it is above makes use of the django-pgtrigger library to write a Postgres trigger to our database, the job of which is to notify our channel whenever a Comment is inserted in to the database. Triggers are far more robust than signals for detecting database write events; application level triggers can easily be missed, whereas triggers will always be executed.
Write Clean Python Code. Always.. Sonar helps you commit clean code every time. With over 225 unique rules to find Python bugs, code smells & vulnerabilities, Sonar finds the issues while you focus on the work.
django-pgpubsub: A lightweight alternative to Celery built on top of the Postgres NOTIFY/LISTEN protocol
1 project | reddit.com/r/django | 2 Dec 2022
django-pgpubsub: Distributed Django Tasks using Postgres NOTIFY
1 project | reddit.com/r/PostgreSQL | 4 Aug 2022
windows-friendly replacement for django=background-tasks?
2 projects | reddit.com/r/django | 19 Jun 2022
push notifications - reminders (Django Rest Framework + Postgresql)
1 project | reddit.com/r/django | 25 May 2022
Asynchronous processing of database events in a robust and lightweight manner using django-pgpubsub
1 project | reddit.com/r/django | 13 May 2022