fix:deadlock und doppelte Mails
CI / audit (push) Skipped
CI / checks (push) Failing after 3m21s
CI / image (push) Skipped

This commit is contained in:
marco.morath committed 2026-11-25 22:15:34 +01:00
1 parent b1531e41e1
commit 8b6f74f364
13 files changed
+69 -27

No files matched your search

+4 -1
View File
@@ -57,7 +57,10 @@ def _capacity(question: Question, option_id: str) -> int | None:
def _lock(db: Session, question: Question) -> None:
db.execute(select(Question.id).where(Question.id == question.id).with_for_update())
# FOR NO KEY UPDATE: sperrt gleichzeitige Buchungen gegeneinander, aber nicht gegen
# Fremdschlüssel-Prüfungen (Antworten auf diese Frage); FOR UPDATE führte zu Deadlocks
db.execute(select(Question.id).where(Question.id == question.id)
.with_for_update(key_share=True))
def _counts(db: Session, question: Question) -> dict[tuple[str, str], int]: