You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Had a quick look at it. I tried adding a second listener to one of the functions in pgpubsub/tests/listeners.py
@pgpubsub.post_save_listener(PostTriggerChannel) # new
@pgpubsub.post_delete_listener(PostTriggerChannel)
def email_author(old: Post, new: Post):
author = Author.objects.get(pk=old.author_id)
print(f'Emailing {author.name} to inform then post '
f'{old.pk} has been edited or deleted.')
email(author)
I can recreate the same issue you mentioned. In fact it looks like the top decorator, post_save_listener, is not registered at all either (adding it didn't even generate a migration to add the new trigger). Right now I'm not sure exactly why that would happen. Unfortunately I don't have any more time to look at this tonight. I will prioritise this for the next release, but not sure exactly when that will be yet. Please feel very free to submit a fix if you can think of one.
PaulGilmartin
changed the title
Incorrectly triggers on TriggerChannel
Decorating a single function with multiple listeners does not work
Feb 13, 2024
Tested in version 1.1.1
I have the following setup:
After a deleting a single record from
MyTable
my console showsI was expecting a single trigger (the delete trigger) but it seems like all the listeners are being triggered.
All migrations are up to date.
The text was updated successfully, but these errors were encountered: