Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store only notification id in the payload for lockable notifications #76

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

romank0
Copy link
Contributor

@romank0 romank0 commented Feb 16, 2024

This fixes #67

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 states. In the listener the payload that is sent via postgres channel is used only to find the appropriate Notification record from the DB (by comparing the payload text) and then the payload is retrieved from the database record and is actually used.

This sending of the complete payload is suboptimal:

  • the serialized size of the record that can be sent is limited by the max payload size (8k) that postgres supports when sending via the channel. Given that both old and new records are sent that size is rather even smaller (<4k) for updates.
  • the serialized payload makes roundtrips from postgres to application (in the NOTIFY message) and then back to pg server (as a query parameter) and yet another time as a query result.

This MR implements sending only the notification ID in the postgres notification for the TriggerChannel that has a persistent notifications enabled.

This implementation keeps the listener backward compatible as in it can still process old notifications sent with a complete payload. That compatiblity should be removed in the followup versions.

@romank0 romank0 changed the title Store only notification id in payload for lockable notifications upstream Store only notification id in the payload for lockable notifications Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not send the complete payload for the TriggerChannel that stores notification in the DB
1 participant