Simultaneous close of a Standard motion throws an uncaught DbUpdateConcurrencyException (BifrostDbContext.cs:288) #30
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
#21 added
entity.Property(x => x.Status).IsConcurrencyToken()to theMotionentity (BifrostDbContext.cs:288) for the sealed-ballot close. It applies to every motion, Standard ones included.MotionGovernanceService.CloseMotionAsync(~:119-128) setsStatusand callsSaveChangesAsyncwith no catch. Two members closing the same Standard motion at once (or a double-submit of the Close form) now runUPDATE ... WHERE Id = @id AND Status = <value read>twice; the second matches no row and EF throwsDbUpdateConcurrencyException. The caller,Pages/App/Motions/Index.cshtml.csOnPostCloseAsync, does not catch it, so the request falls toUseExceptionHandler("/Error")(Program.cs:270): the loser gets the error page (HTTP 500), not the redirect. Before #21 the second close silently overwrote the first.Expected: the loser reloads, sees the motion already closed by the winner, records no second
motion.closedaudit event, and redirects as normal. The sealed closer already does this (SealedBallotService.cs:307).Not verified: the SQL EF emits, behaviour on Postgres (the finding is from reading the model and the in-memory provider). Fix and test in the linked PR.