Run queries in a transaction again

This commit is contained in:
Joe Nelson
2016-01-24 18:09:19 -08:00
parent ac73e8d77b
commit 51f71eb53d
3 changed files with 26 additions and 2 deletions
+3 -1
View File
@@ -11,6 +11,7 @@ import PostgREST.Config (AppConfig (..),
import PostgREST.DbStructure
import PostgREST.Error (errResponse, pgErrResponse)
import PostgREST.Middleware
import PostgREST.QueryBuilder (inTransaction, Isolation(..))
import Control.Monad (unless, void)
import Data.Monoid ((<>))
@@ -94,7 +95,8 @@ main = do
runSettings appSettings $ middle $ \ req respond -> do
time <- getPOSIXTime
body <- strictRequestBody req
let handleReq = H.run (runWithClaims conf time (app dbStructure conf body) req)
let handleReq = H.run $ inTransaction ReadCommitted
(runWithClaims conf time (app dbStructure conf body) req)
withResource pool $ \case
Left err -> respond $ errResponse HT.status500 (cs . show $ err)
Right c -> do