Skip to content

Commit

Permalink
Merge pull request #1748 from fractal-analytics-platform/1741-drop-tr…
Browse files Browse the repository at this point in the history
…yexcept-for-integrityerror-in-first-user-creation

Drop try/except for IntegrityError in first-user creation
  • Loading branch information
ychiucco committed Sep 10, 2024
2 parents c54b41d + 42c046e commit 88f5358
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# 2.4.0

* App:
* Move creation of first user from application startup into `fractalctl set-db` command (\#1738).
* Move creation of first user from application startup into `fractalctl set-db` command (\#1738, \#1748).
* Add creation of default user group into `fractalctl set-db` command (\#1738).
* Create `update-db-script` for current version, that adds all users to default group (\#1738).
* API:
Expand Down
7 changes: 0 additions & 7 deletions fractal_server/app/security/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
from fastapi_users.models import ID
from fastapi_users.models import OAP
from fastapi_users.models import UP
from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import selectinload
from sqlmodel import func
Expand Down Expand Up @@ -295,12 +294,6 @@ async def _create_first_user(
user = await user_manager.create(UserCreate(**kwargs))
logger.info(f"User {user.email} created")

except IntegrityError:
logger.warning(
f"Creation of user {email} failed with IntegrityError "
"(likely due to concurrent attempts from different workers)."
)

except UserAlreadyExists:
logger.warning(f"User {email} already exists")

Expand Down

0 comments on commit 88f5358

Please sign in to comment.