Skip to content
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

[0.17.x] Enhance creation of default settings (#9028) #9029

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/backend/InvenTree/common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,6 @@ def build_default_values(cls, **kwargs):

If a particular setting is not present, create it with the default value
"""
cache_key = f'BUILD_DEFAULT_VALUES:{cls.__name__!s}'

try:
if InvenTree.helpers.str2bool(cache.get(cache_key, False)):
# Already built default values
return
except Exception:
pass

try:
existing_keys = cls.objects.filter(**kwargs).values_list('key', flat=True)
settings_keys = cls.SETTINGS.keys()
Expand All @@ -194,11 +185,6 @@ def build_default_values(cls, **kwargs):
'Failed to build default values for %s (%s)', str(cls), str(type(exc))
)

try:
cache.set(cache_key, True, timeout=3600)
except Exception:
pass

def _call_settings_function(self, reference: str, args, kwargs):
"""Call a function associated with a particular setting.

Expand Down