mask $ \restore -> do
begin
r <- restore action `onException` rollback
commit
return r
The problem is that commit can throw (synchronous) exception itself (ErrorBusy and ErrorLocked) leaving us inside transaction. But at least in case of ErrorBusy it can be retried.
mask $ \restore → do
begin
(restore act <* commit) `onException` rollback
sqlite-simple/Database/SQLite/Simple.hs
Line 499 in c2f216a
The problem is that
commitcan throw (synchronous) exception itself (ErrorBusyandErrorLocked) leaving us inside transaction. But at least in case ofErrorBusyit can be retried.