Move signal import to django.core #1357
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
Hi 👋 , I believe this is causing us a problem, but I lack technical rigor to be able to explain it fully. By applying this change under certain circumstances, I seem to avoid a core dump that happens as uWSGI recycles workers when it is running in the default prefork mode. The most relevant description of the series of events is this comment: unbit/uwsgi#1969 (comment)
Here, I just wish to present this as an improvement to follow best practice. In the
django.test.signals
module, you can see it imports from this modification with no modifications.https://github.com/django/django/blob/main/django/test/signals.py
However, somewhat obviously... if you import this test module, you will also register all the test signal connections. Now, that shouldn't do anything because the
setting_changed
signal is documented to only fire when running tests. However, it also pulls in a lot of other imports which just aren't needed, and as this happens in settings, it triggers fairly early in app load order.This argument also applies to 1 import in DRF, which I also hope to submit a patch for. I'm still working out final testing on my side, so consider this a draft as of opening.
Checklist
CHANGELOG.md
updated (only for user relevant changes)AUTHORS