这是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
8 changes: 4 additions & 4 deletions server/src-lib/Hasura/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ initialiseCtx hgeCmd rci = do
eDbId <- liftIO $ runExceptT $ Q.runTx pool (Q.Serializable, Nothing) getDbId
dbId <- either printErrJExit return eDbId

return $ (InitCtx httpManager instanceId dbId loggers connInfo pool, initTime)
return (InitCtx httpManager instanceId dbId loggers connInfo pool, initTime)
where
procConnInfo =
either (printErrExit . connInfoErrModifier) return $ mkConnInfo rci
Expand Down Expand Up @@ -205,12 +205,12 @@ runHGEServer ServeOptions{..} InitCtx{..} initTime = do
Loggers loggerCtx logger _ = _icLoggers

authModeRes <- runExceptT $ mkAuthMode soAdminSecret soAuthHook soJwtSecret soUnAuthRole
_icHttpManager loggerCtx
_icHttpManager logger

authMode <- either (printErrExit . T.unpack) return authModeRes

HasuraApp app cacheRef cacheInitTime shutdownApp <- mkWaiApp soTxIso
loggerCtx
logger
sqlGenCtx
soEnableAllowlist
_icPgPool
Expand Down Expand Up @@ -249,7 +249,7 @@ runHGEServer ServeOptions{..} InitCtx{..} initTime = do
eventEngineCtx <- liftIO $ atomically $ initEventEngineCtx maxEvThrds evFetchMilliSec
let scRef = _scrCache cacheRef
unLogger logger $ mkGenericStrLog LevelInfo "event_triggers" "starting workers"
void $ liftIO $ C.forkIO $ processEventQueue loggerCtx logEnvHeaders
void $ liftIO $ C.forkIO $ processEventQueue logger logEnvHeaders
_icHttpManager _icPgPool scRef eventEngineCtx

-- start a background thread to check for updates
Expand Down
9 changes: 4 additions & 5 deletions server/src-lib/Hasura/Events/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,15 @@ initEventEngineCtx maxT fetchI = do
return $ EventEngineCtx q c maxT fetchI

processEventQueue
:: L.LoggerCtx L.Hasura -> LogEnvHeaders -> HTTP.Manager-> Q.PGPool
:: L.Logger L.Hasura -> LogEnvHeaders -> HTTP.Manager-> Q.PGPool
-> IORef (SchemaCache, SchemaCacheVer) -> EventEngineCtx
-> IO ()
processEventQueue logctx logenv httpMgr pool cacheRef eectx = do
processEventQueue logger logenv httpMgr pool cacheRef eectx = do
threads <- mapM async [fetchThread, consumeThread]
void $ waitAny threads
where
fetchThread = pushEvents (L.mkLogger logctx) pool eectx
consumeThread = consumeEvents (L.mkLogger logctx)
logenv httpMgr pool (CacheRef cacheRef) eectx
fetchThread = pushEvents logger pool eectx
consumeThread = consumeEvents logger logenv httpMgr pool (CacheRef cacheRef) eectx

pushEvents
:: L.Logger L.Hasura -> Q.PGPool -> EventEngineCtx -> IO ()
Expand Down
5 changes: 2 additions & 3 deletions server/src-lib/Hasura/Server/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ mkWaiApp
, MetadataApiAuthorization m
)
=> Q.TxIsolation
-> L.LoggerCtx L.Hasura
-> L.Logger L.Hasura
-> SQLGenCtx
-> Bool
-> Q.PGPool
Expand All @@ -447,7 +447,7 @@ mkWaiApp
-> EL.LiveQueriesOptions
-> E.PlanCacheOptions
-> m HasuraApp
mkWaiApp isoLevel loggerCtx sqlGenCtx enableAL pool ci httpManager mode corsCfg enableConsole consoleAssetsDir
mkWaiApp isoLevel logger sqlGenCtx enableAL pool ci httpManager mode corsCfg enableConsole consoleAssetsDir
enableTelemetry instanceId apis lqOpts planCacheOptions = do

let pgExecCtx = PGExecCtx pool isoLevel
Expand All @@ -466,7 +466,6 @@ mkWaiApp isoLevel loggerCtx sqlGenCtx enableAL pool ci httpManager mode corsCfg
planCache <- liftIO $ E.initPlanCache planCacheOptions

let corsPolicy = mkDefaultCorsPolicy corsCfg
logger = L.mkLogger loggerCtx

lqState <- liftIO $ EL.initLiveQueriesState lqOpts pgExecCtx
wsServerEnv <- liftIO $ WS.createWSServerEnv logger pgExecCtx lqState cacheRef httpManager corsPolicy
Expand Down
11 changes: 5 additions & 6 deletions server/src-lib/Hasura/Server/Auth.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,16 @@ mkAuthMode
-> Maybe JWTConfig
-> Maybe RoleName
-> H.Manager
-> LoggerCtx Hasura
-> Logger Hasura
-> m AuthMode
mkAuthMode mAdminSecret mWebHook mJwtSecret mUnAuthRole httpManager lCtx =
mkAuthMode mAdminSecret mWebHook mJwtSecret mUnAuthRole httpManager logger =
case (mAdminSecret, mWebHook, mJwtSecret) of
(Nothing, Nothing, Nothing) -> return AMNoAuth
(Just key, Nothing, Nothing) -> return $ AMAdminSecret key mUnAuthRole
(Just key, Just hook, Nothing) -> unAuthRoleNotReqForWebHook >>
return (AMAdminSecretAndHook key hook)
(Just key, Nothing, Just jwtConf) -> do
jwtCtx <- mkJwtCtx jwtConf httpManager lCtx
jwtCtx <- mkJwtCtx jwtConf httpManager logger
return $ AMAdminSecretAndJWT key jwtCtx mUnAuthRole

(Nothing, Just _, Nothing) -> throwError $
Expand All @@ -122,14 +122,13 @@ mkJwtCtx
)
=> JWTConfig
-> H.Manager
-> LoggerCtx Hasura
-> Logger Hasura
-> m JWTCtx
mkJwtCtx conf httpManager loggerCtx = do
mkJwtCtx conf httpManager logger = do
jwkRef <- case jcKeyOrUrl conf of
Left jwk -> liftIO $ newIORef (JWKSet [jwk])
Right url -> do
ref <- liftIO $ newIORef $ JWKSet []
let logger = mkLogger loggerCtx
mTime <- updateJwkRef logger httpManager url ref
case mTime of
Nothing -> return ref
Expand Down