mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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:
parent
9ebbc2f9f6
commit
8b730884d7
@ -195,8 +195,8 @@ class InvenTreeConfig(AppConfig):
|
|||||||
else:
|
else:
|
||||||
new_user = user.objects.create_superuser(add_user, add_email, add_password)
|
new_user = user.objects.create_superuser(add_user, add_email, add_password)
|
||||||
logger.info(f'User {str(new_user)} was created!')
|
logger.info(f'User {str(new_user)} was created!')
|
||||||
except IntegrityError as _e:
|
except IntegrityError:
|
||||||
logger.warning(f'The user "{add_user}" could not be created due to the following error:\n{str(_e)}')
|
logger.warning(f'The user "{add_user}" could not be created')
|
||||||
|
|
||||||
# do not try again
|
# do not try again
|
||||||
settings.USER_ADDED = True
|
settings.USER_ADDED = True
|
||||||
|
@ -182,13 +182,15 @@ class LabelConfig(AppConfig):
|
|||||||
|
|
||||||
logger.info(f"Creating entry for {model} '{label['name']}'")
|
logger.info(f"Creating entry for {model} '{label['name']}'")
|
||||||
|
|
||||||
model.objects.create(
|
try:
|
||||||
name=label['name'],
|
model.objects.create(
|
||||||
description=label['description'],
|
name=label['name'],
|
||||||
label=filename,
|
description=label['description'],
|
||||||
filters='',
|
label=filename,
|
||||||
enabled=True,
|
filters='',
|
||||||
width=label['width'],
|
enabled=True,
|
||||||
height=label['height'],
|
width=label['width'],
|
||||||
)
|
height=label['height'],
|
||||||
return
|
)
|
||||||
|
except Exception:
|
||||||
|
logger.warning(f"Failed to create label '{label['name']}'")
|
||||||
|
@ -42,7 +42,7 @@ INVENTREE_DB_PORT=5432
|
|||||||
#INVENTREE_CACHE_PORT=6379
|
#INVENTREE_CACHE_PORT=6379
|
||||||
|
|
||||||
# Options for gunicorn server
|
# Options for gunicorn server
|
||||||
INVENTREE_GUNICORN_TIMEOUT=30
|
INVENTREE_GUNICORN_TIMEOUT=90
|
||||||
|
|
||||||
# Enable custom plugins?
|
# Enable custom plugins?
|
||||||
INVENTREE_PLUGINS_ENABLED=False
|
INVENTREE_PLUGINS_ENABLED=False
|
||||||
|
Loading…
Reference in New Issue
Block a user