mirror of
https://github.com/nikita-volkov/hasql.git
synced 2024-11-26 11:57:01 +03:00
Fix the bug
This commit is contained in:
parent
f2853be639
commit
eb0163c6d8
@ -249,16 +249,16 @@ tx m t =
|
||||
Backend b =>
|
||||
Backend.TransactionMode -> Backend.Connection b -> IO r -> IO r
|
||||
inTransaction mode c io =
|
||||
do
|
||||
Backend.beginTransaction mode c
|
||||
try io >>= \case
|
||||
Left Backend.TransactionConflict -> do
|
||||
Backend.finishTransaction False c
|
||||
inTransaction mode c io
|
||||
Left e -> throwIO e
|
||||
Right r -> do
|
||||
Backend.finishTransaction True c
|
||||
return r
|
||||
let
|
||||
io' =
|
||||
Backend.beginTransaction mode c *> io <* Backend.finishTransaction True c
|
||||
in
|
||||
try io' >>= \case
|
||||
Left Backend.TransactionConflict -> do
|
||||
Backend.finishTransaction False c
|
||||
inTransaction mode c io
|
||||
Left e -> throwIO e
|
||||
Right r -> return r
|
||||
|
||||
|
||||
-- * Results Stream
|
||||
|
Loading…
Reference in New Issue
Block a user