Fix the bug

This commit is contained in:
Nikita Volkov 2014-12-18 02:18:07 +03:00
parent f2853be639
commit eb0163c6d8

View File

@ -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
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 -> do
Backend.finishTransaction True c
return r
Right r -> return r
-- * Results Stream