-
Notifications
You must be signed in to change notification settings - Fork 419
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
fix: use sender for m2m signal dispatch connection #686
Conversation
This fix adds support for a use case where a single m2m through model is used on multiple models. When the reciever is used for the dispatch uid in this use case it cause duplicated logs because the through model singal connection happens multiple times. By changing the m2m signal connection to use the sender for the dispatch uid this duplication is prevented because the signal connection only happens once for the through model. Refs: #685
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #686 +/- ##
==========================================
+ Coverage 95.21% 95.49% +0.27%
==========================================
Files 31 32 +1
Lines 1025 1087 +62
==========================================
+ Hits 976 1038 +62
Misses 49 49 ☔ View full report in Codecov by Sentry. |
Thanks @cdubz for reporting the issue and for the fix PR. You can easily run a Postgres in your machine by Please remember to add a changelog entry as well |
Oh yeah! I will add a test and changelog entry. Thanks! |
Ok, I think this is ready for review again -- not used to this set of formatting tools 😁 I confirmed the test I added reproduces the issue on |
Thanks @cdubz |
Thanks for the quick review! |
This fix adds support for a use case where a single m2m through model is used on multiple models. When the receiver is used for the dispatch uid in this use case it cause duplicated logs because the through model signal connection happens multiple times.
By changing the m2m signal connection to use the sender for the dispatch uid this duplication is prevented because the signal connection only happens once for the through model.
Fixes #685
I wasn't able to run tests as I don't have a postgres database connection handy and I couldn't get the tests to work with SQLite. Test still need to be run and probably a test should be added for this use case.