🐛 fix(manager.py): improve readability by splitting a long line into multiple lines
🐛 fix(utils.py): add comment to explain the reason for the check
This commit is contained in:
parent
65c6516575
commit
ad406541f2
2 changed files with 6 additions and 1 deletions
|
|
@ -66,7 +66,9 @@ class DatabaseService(Service):
|
|||
if settings_service.auth_settings.AUTO_LOGIN:
|
||||
with Session(self.engine) as session:
|
||||
flows = (
|
||||
session.query(models.Flow).filter(models.Flow.user_id == None).all()
|
||||
session.query(models.Flow)
|
||||
.filter(models.Flow.user_id == None) # noqa
|
||||
.all()
|
||||
)
|
||||
if flows:
|
||||
logger.debug("Migrating flows to default superuser")
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ def get_or_create_super_user(session: Session, username, password, is_default):
|
|||
return create_super_user(username, password, db=session)
|
||||
except Exception as exc:
|
||||
if "UNIQUE constraint failed: user.username" in str(exc):
|
||||
# This is to deal with workers running this
|
||||
# at startup and trying to create the superuser
|
||||
# at the same time.
|
||||
logger.debug("Superuser already exists.")
|
||||
return None
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue