PaulGilmartin / django-pgpubsub

A distributed task processing framework for Django built on top of the Postgres NOTIFY/LISTEN protocol.
Other
245 stars 12 forks source link

Do not send the complete payload for the TriggerChannel that stores notification in the DB #67

Open romank0 opened 1 year ago

romank0 commented 1 year ago

Currently for the updated django entity that has an associated TriggerChannel the notification payload is sent via postgres NOTIFY and it contains the old and the new serialized entity state. On the listener the payload sent via postgres channel is used only to find the appropriate Notification record from the DB and then the payload from the record is used.

This sending of the complete payload is suboptimal:

The better solution seems to be to send only the notification ID for the TriggerChannel that has a persistent notifications.

romank0 commented 9 months ago

I have an implementation of this but it depends and is based on PRs that are not yet merged https://github.com/Opus10/django-pgpubsub/pull/66 and https://github.com/Opus10/django-pgpubsub/pull/73 and there might be some amendments to the approach there so I'll add a PR for this when it will be clear what migration path will be chosen there.