Repository navigation
Plugin reload limitations - #13007
Merged
SchrodingersGat merged 5 commits intoOct 13, 2026
Merged
Conversation
Ensure entire module is reloaded
✅ Deploy Preview for inventree-web-pui-preview canceled.
|
matmair
approved these changes
Oct 13, 2026
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #13007 +/- ##
========================================
Coverage 87.25% 87.25%
========================================
Files 1512 1512
Lines 104094 104315 +221
Branches 11760 11789 +29
========================================
+ Hits 90827 91025 +198
- Misses 13204 13223 +19
- Partials 63 67 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
lucaci32u4
added a commit
to Alacrity-Education/InvenTree
that referenced
this pull request
Oct 15, 2026
reload_plugins() re-populates the Django apps registry (registry._reload_apps) while apps.ready is False, so the Apps.clear_cache() calls populate() makes skip the per-model cache expiry. Relation trees and field caches built before the reload then never learn about models registered during it. Since inventree#13007 the plugin package is purged from sys.modules on every collect, so a plugin's models module is imported inside populate() rather than by AppMixin._reregister_contrib_apps() afterwards (which reloaded it with the registry ready, expiring the caches as a side effect). After a reload, core models no longer know the plugin's foreign keys: reverse accessors are missing and on_delete cascades are not collected, so deleting a Group or a User referenced by a plugin table fails on the database constraint. Call apps.clear_cache() once the registry is populated again. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
There are limitations to how far "auto plugin reload" can go, as the automatic reload functionality:
This can result in circular plugin reload cycles, with different processes fighting over the plugin hash indefinitely.
This PR: