Closed wolflu05 closed 1 week ago
@wolflu05 thanks for giving this some attention. I remember there was an issue when @afkiwers was developing the inventree-kicad-plugin where a dual-load of custom plugin models caused some issues. This is probably the same "bug".
This is expected behaviour IMO. All (django) apps must be reloaded for model discovery once AppMixin plugins are activated thus running all ready() methods twice (once during "normal" startup and once during our forced "plugin" mode-rediscovery). I think this implementation is the only one that makes sense because prior to https://github.com/inventree/InvenTree/pull/5649/ we had random issues with half-patched model registries.
But why can't we just wait until everything in the plugin registry is ready and then run the ready functions of the label app/.... this is what the isPluginRegistryLoaded function was for. It should early return in the ready function if the apps are not altered loaded correctly, and only run the rest if all reloads are done. And it was already working, but broke with the linked PR.
From what I rember we had multiple unexplainable problems with plugin models before the PR and I am not aware of any after. There were these random plugin errors in the CI that disappeared after that PR and problems with notifications plugins that used custom models sometimes raising error about not been initilaized.
This issue seems stale. Please react to show this is still important.
I think this Is still happening.
This issue seems stale. Please react to show this is still important.
I think this Is still happening.
This issue seems stale. Please react to show this is still important.
I have tried to check this again, cannot reproduce on a production setup anymore, so closing that out now.
Please verify that this bug has NOT been raised before.
Describe the bug*
The app configs ready code gets run twice (
isPluginRegistryLoaded
andisInMainThread
is already applied before).Steps to Reproduce
To see this behavior, e.g. just apply the following diff, run the app :
Expected behaviour
The ready filters filter everything out, so that the ready code is only run once.
I already knew that I fixed this behavior in #5005 so I git bisected it and found out, that #5649 (06eb948528e945b41ea3ceb7ae75709eb1d639e0) is the first bad commit. Do you have any idea what is causing that?
Deployment Method
Version Information
Version Information:
InvenTree-Version: 0.14.0 dev Django Version: 3.2.23 Commit Hash: f88d557 Commit Date: 2024-02-05 Commit Branch: master Database: sqlite3 Debug-Mode: True Deployed using Docker: False Platform: Linux-6.5.11-linuxkit-x86_64-with-glibc2.31 Installer: GIT
Active plugins: []
Please verify if you can reproduce this bug on the demo site.
Relevant log output