Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Only catch SqlError in retryLoop
  • Loading branch information
3noch committed Oct 15, 2019
commit e02684f9c38acf736ac590b36b919000a2b45bc4
8 changes: 4 additions & 4 deletions src/Database/PostgreSQL/Simple/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ withTransactionModeRetry mode shouldRetry conn act =
commit conn
return a
where
retryLoop :: IO (Either E.SomeException a) -> IO a
retryLoop :: IO (Either SqlError a) -> IO a
retryLoop act' = do
beginMode mode conn
r <- act'
case r of
Left e ->
case fmap shouldRetry (E.fromException e) of
Just True -> retryLoop act'
_ -> E.throwIO e
case shouldRetry e of
True -> retryLoop act'
False -> E.throwIO e
Right a ->
return a

Expand Down