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

Notification ordering #54

Closed p-baum closed 1 year ago

p-baum commented 1 year ago

Change sequence is significant. I am concerned that my changes may be out of sequence. Can we please add the following attribute to the Notification Meta class:

ordering = ['created_at']

Related to: https://github.com/Opus10/django-pgpubsub/issues/36

PaulGilmartin commented 1 year ago

@p-baum Thanks for raising. Ordering of notifications in the queue is indeed currently not guaranteed. I can see that using the created_at ordering you suggest would be a simple way of processing stored Notifications in the order in which the transactions which created them committed (which i imagine is the order someone would want most of the time). I can add this in to the next release, which I'll try to make time for this summer. If you would like it sooner, feel free to submit a pull request :)

PaulGilmartin commented 1 year ago

@p-baum I have added the ordering in this commit: https://github.com/Opus10/django-pgpubsub/commit/ecd95eb1405d544453abe77e36f5719094c12d85. I'll do a proper release to pypi with the fix (and others) soon.