Skip to content

Commit

Permalink
Prevent creation of new PluginConfig during data import (#6247)
Browse files Browse the repository at this point in the history
* Prevent creation of new PluginConfig during data import

- Fixes race condition which can occur sometimes

* typo fix
  • Loading branch information
SchrodingersGat committed Jan 16, 2024
1 parent 716e577 commit 7cd6252
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions InvenTree/plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ def human_name(self):

def plugin_config(self):
"""Return the PluginConfig object associated with this plugin."""
import InvenTree.ready

# Database contains no information yet - return None
if InvenTree.ready.isImportingData():
return None

try:
import plugin.models

Expand All @@ -104,6 +110,8 @@ def plugin_config(self):
)
except (OperationalError, ProgrammingError):
cfg = None
except plugin.models.PluginConfig.DoesNotExist:
cfg = None

return cfg

Expand Down

0 comments on commit 7cd6252

Please sign in to comment.