这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions server/src-lib/Hasura/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ migrateCatalogSchema env logger pool httpManager sqlGenCtx = do
let pgExecCtx = mkPGExecCtx Q.Serializable pool
adminRunCtx = RunCtx adminUserInfo httpManager sqlGenCtx
currentTime <- liftIO Clock.getCurrentTime
initialiseResult <- runExceptT $ peelRun adminRunCtx pgExecCtx Q.ReadWrite $
initialiseResult <- runExceptT $ peelRun adminRunCtx pgExecCtx Q.ReadWrite Nothing $
(,) <$> migrateCatalog env currentTime <*> liftTx fetchLastUpdate

((migrationResult, schemaCache), lastUpdateEvent) <-
Expand Down Expand Up @@ -586,7 +586,7 @@ runAsAdmin
runAsAdmin pool sqlGenCtx httpManager m = do
let runCtx = RunCtx adminUserInfo httpManager sqlGenCtx
pgCtx = mkPGExecCtx Q.Serializable pool
runExceptT $ peelRun runCtx pgCtx Q.ReadWrite m
runExceptT $ peelRun runCtx pgCtx Q.ReadWrite Nothing m

execQuery
:: ( HasVersion
Expand Down
3 changes: 2 additions & 1 deletion server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,9 @@ onStart env serverEnv wsConn (StartMsg opId q) = catchAndIgnore $ do
Tracing.interpTraceT id $ executeQuery queryParsed asts genSql pgExecCtx Q.ReadOnly opTx
-- Response headers discarded over websockets
E.ExOpMutation _ opTx -> Tracing.trace "pg" do
ctx <- Tracing.currentContext
execQueryOrMut Telem.Mutation Nothing $
Tracing.interpTraceT (runLazyTx pgExecCtx Q.ReadWrite . withUserInfo userInfo) opTx
Tracing.interpTraceT (runLazyTx pgExecCtx Q.ReadWrite . withTraceContext ctx . withUserInfo userInfo) opTx
E.ExOpSubs lqOp -> do
-- log the graphql query
logQueryLog logger query Nothing reqId
Expand Down
6 changes: 4 additions & 2 deletions server/src-lib/Hasura/RQL/Types/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Control.Monad.Trans.Control (MonadBaseControl)
import Control.Monad.Unique

import Hasura.RQL.Types
import qualified Hasura.Tracing as Tracing

data RunCtx
= RunCtx
Expand Down Expand Up @@ -50,7 +51,8 @@ peelRun
=> RunCtx
-> PGExecCtx
-> Q.TxAccess
-> Maybe Tracing.TraceContext
-> Run a
-> ExceptT QErr m a
peelRun runCtx@(RunCtx userInfo _ _) pgExecCtx txAccess (Run m) =
runLazyTx pgExecCtx txAccess $ withUserInfo userInfo $ runReaderT m runCtx
peelRun runCtx@(RunCtx userInfo _ _) pgExecCtx txAccess ctx (Run m) =
runLazyTx pgExecCtx txAccess $ maybe id withTraceContext ctx $ withUserInfo userInfo $ runReaderT m runCtx
3 changes: 2 additions & 1 deletion server/src-lib/Hasura/Server/API/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,11 @@ runQuery
-> SQLGenCtx -> SystemDefined -> RQLQuery -> m (EncJSON, RebuildableSchemaCache Run)
runQuery env pgExecCtx instanceId userInfo sc hMgr sqlGenCtx systemDefined query = do
accessMode <- getQueryAccessMode query
traceCtx <- Tracing.currentContext
resE <- runQueryM env query & Tracing.interpTraceT \x -> do
a <- x & runHasSystemDefinedT systemDefined
& runCacheRWT sc
& peelRun runCtx pgExecCtx accessMode
& peelRun runCtx pgExecCtx accessMode (Just traceCtx)
& runExceptT
& liftIO
pure (either
Expand Down
2 changes: 1 addition & 1 deletion server/src-lib/Hasura/Server/SchemaUpdate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ refreshSchemaCache sqlGenCtx pool logger httpManager cacheRef invalidations thre
rebuildableCache <- fst <$> liftIO (readIORef $ _scrCache cacheRef)
((), cache, _) <- buildSchemaCacheWithOptions CatalogSync invalidations
& runCacheRWT rebuildableCache
& peelRun runCtx pgCtx PG.ReadWrite
& peelRun runCtx pgCtx PG.ReadWrite Nothing
pure ((), cache)
case resE of
Left e -> logError logger threadType $ TEQueryError e
Expand Down
2 changes: 1 addition & 1 deletion server/src-test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ buildPostgresSpecs pgConnOptions = do

runAsAdmin :: Run a -> IO a
runAsAdmin =
peelRun runContext pgContext Q.ReadWrite
peelRun runContext pgContext Q.ReadWrite Nothing
>>> runExceptT
>=> flip onLeft printErrJExit

Expand Down