Portal members: a request that loses the adoption race reads back the winner's user instead of being refused
Docs / docs (push) Successful in 23s
Playwright Tests / test-playwright (1, 2) (push) Failing after 1m16s
Playwright Tests / test-playwright (2, 2) (push) Failing after 19s
pre-commit / pre-commit (push) Failing after 2m17s
Test Backend / test-backend (3.12) (push) Successful in 4m51s
Test Backend / test-backend (3.14) (push) Successful in 4m32s
Compose Smoke Test / test-compose (push) Failing after 26s
Playwright Tests / merge-reports (push) Failing after 2m17s
Docs / docs (push) Successful in 23s
Playwright Tests / test-playwright (1, 2) (push) Failing after 1m16s
Playwright Tests / test-playwright (2, 2) (push) Failing after 19s
pre-commit / pre-commit (push) Failing after 2m17s
Test Backend / test-backend (3.12) (push) Successful in 4m51s
Test Backend / test-backend (3.14) (push) Successful in 4m32s
Compose Smoke Test / test-compose (push) Failing after 26s
Playwright Tests / merge-reports (push) Failing after 2m17s
This commit is contained in:
@@ -216,11 +216,12 @@ def adopt_member(session: Session, portal_sub: str) -> User | None:
|
||||
return None
|
||||
try:
|
||||
return create_remote_user(session, portal_sub, str(member["email"]))
|
||||
except EnrollError:
|
||||
return None
|
||||
except IntegrityError:
|
||||
except (EnrollError, IntegrityError):
|
||||
# A first page load fires several requests and the websocket at once,
|
||||
# all of them missing the row and all of them creating it. Whoever
|
||||
# loses reads back what the winner wrote.
|
||||
# loses, at the unique index or at the checks before it (the winner
|
||||
# may commit while this one asks the portal), reads back what the
|
||||
# winner wrote. An email another local account holds finds nothing to
|
||||
# read back and stays refused.
|
||||
session.rollback()
|
||||
return session.exec(select(User).where(User.portal_sub == portal_sub)).first()
|
||||
|
||||
Reference in New Issue
Block a user