2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-16 17:56:30 +00:00

Handle exception when creating default labels (#5163)

* Handle exception when creating default labels

- Running workers in parallel may cause race conditions
- Catch any exception which is raised

* Prevent password from being logged

* Update default timeout for docker
This commit is contained in:
Oliver
2023-07-04 22:46:03 +10:00
committed by GitHub
parent 9ebbc2f9f6
commit 8b730884d7
3 changed files with 15 additions and 13 deletions

View File

@@ -182,13 +182,15 @@ class LabelConfig(AppConfig):
logger.info(f"Creating entry for {model} '{label['name']}'")
model.objects.create(
name=label['name'],
description=label['description'],
label=filename,
filters='',
enabled=True,
width=label['width'],
height=label['height'],
)
return
try:
model.objects.create(
name=label['name'],
description=label['description'],
label=filename,
filters='',
enabled=True,
width=label['width'],
height=label['height'],
)
except Exception:
logger.warning(f"Failed to create label '{label['name']}'")