mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
Use TIMESTAMPTZ
This commit is contained in:
parent
c93a00b327
commit
8cc548abf0
@ -210,7 +210,7 @@ processEventQueue logger logenv httpMgr pool getSchemaCache eeCtx@EventEngineCtx
|
||||
Tracing.runTraceTInContext
|
||||
tracingCtx
|
||||
t <- processEvent event
|
||||
& runTraceT "Event trigger"
|
||||
& runTraceT "process event"
|
||||
& withEventEngineCtx eeCtx
|
||||
& flip runReaderT (logger, httpMgr)
|
||||
& LA.async
|
||||
|
@ -376,7 +376,7 @@ processCronEvents logger logEnv httpMgr pgpool getSC lockedCronEvents = do
|
||||
ctiRetryConf
|
||||
ctiHeaders
|
||||
ctiComment
|
||||
finally <- Tracing.runTraceT "Scheduled event" . runExceptT $
|
||||
finally <- Tracing.runTraceT "scheduled event" . runExceptT $
|
||||
runReaderT (processScheduledEvent logEnv pgpool scheduledEvent CronScheduledEvent) (logger, httpMgr)
|
||||
removeEventFromLockedEvents id' lockedCronEvents
|
||||
either logInternalError pure finally
|
||||
@ -431,7 +431,7 @@ processStandAloneEvents env logger logEnv httpMgr pgpool lockedStandAloneEvents
|
||||
retryConf
|
||||
headerInfo'
|
||||
comment
|
||||
finally <- Tracing.runTraceT "Scheduled event" . runExceptT $
|
||||
finally <- Tracing.runTraceT "scheduled event" . runExceptT $
|
||||
runReaderT (processScheduledEvent logEnv pgpool scheduledEvent StandAloneEvent) $
|
||||
(logger, httpMgr)
|
||||
removeEventFromLockedEvents id' lockedStandAloneEvents
|
||||
|
@ -428,7 +428,7 @@ asyncActionsProcessor env logger cacheRef pgPool httpManager = forever $ do
|
||||
either mempty return res
|
||||
|
||||
callHandler :: ActionCache -> ActionLogItem -> m ()
|
||||
callHandler actionCache actionLogItem = Tracing.runTraceT "Async actions processor" do
|
||||
callHandler actionCache actionLogItem = Tracing.runTraceT "async actions processor" do
|
||||
let ActionLogItem actionId actionName reqHeaders
|
||||
sessionVariables inputPayload = actionLogItem
|
||||
case Map.lookup actionName actionCache of
|
||||
|
@ -168,12 +168,12 @@ runHasuraGQ
|
||||
runHasuraGQ reqId (query, queryParsed) userInfo resolvedOp = do
|
||||
(E.ExecutionCtx logger _ pgExecCtx _ _ _ _ _) <- ask
|
||||
(telemTimeIO, respE) <- withElapsedTime $ runExceptT $ case resolvedOp of
|
||||
E.ExOpQuery tx genSql asts -> trace "Query" $ do
|
||||
E.ExOpQuery tx genSql asts -> trace "pg" $ do
|
||||
-- log the generated SQL and the graphql query
|
||||
logQueryLog logger query genSql reqId
|
||||
Tracing.interpTraceT id $ executeQuery queryParsed asts genSql pgExecCtx Q.ReadOnly tx
|
||||
|
||||
E.ExOpMutation respHeaders tx -> trace "Mutation" $ do
|
||||
E.ExOpMutation respHeaders tx -> trace "pg" $ do
|
||||
logQueryLog logger query Nothing reqId
|
||||
ctx <- Tracing.currentContext
|
||||
(respHeaders,) <$> Tracing.interpTraceT (runLazyTx pgExecCtx Q.ReadWrite . withTraceContext ctx . withUserInfo userInfo) tx
|
||||
|
@ -363,11 +363,11 @@ onStart env serverEnv wsConn (StartMsg opId q) = catchAndIgnore $ do
|
||||
-> E.ExecOp (Tracing.TraceT (LazyTx QErr))
|
||||
-> ExceptT () m ()
|
||||
runHasuraGQ timerTot telemCacheHit reqId query queryParsed userInfo = \case
|
||||
E.ExOpQuery opTx genSql asts -> Tracing.trace "Query" $
|
||||
E.ExOpQuery opTx genSql asts -> Tracing.trace "pg" $
|
||||
execQueryOrMut Telem.Query genSql . fmap snd $
|
||||
Tracing.interpTraceT id $ executeQuery queryParsed asts genSql pgExecCtx Q.ReadOnly opTx
|
||||
-- Response headers discarded over websockets
|
||||
E.ExOpMutation _ opTx -> Tracing.trace "Mutation" do
|
||||
E.ExOpMutation _ opTx -> Tracing.trace "pg" do
|
||||
execQueryOrMut Telem.Mutation Nothing $
|
||||
Tracing.interpTraceT (runLazyTx pgExecCtx Q.ReadWrite . withUserInfo userInfo) opTx
|
||||
E.ExOpSubs lqOp -> do
|
||||
@ -524,7 +524,7 @@ onMessage
|
||||
-> AuthMode
|
||||
-> WSServerEnv
|
||||
-> WSConn -> BL.ByteString -> m ()
|
||||
onMessage env authMode serverEnv wsConn msgRaw = Tracing.runTraceT "Websocket" do
|
||||
onMessage env authMode serverEnv wsConn msgRaw = Tracing.runTraceT "websocket" do
|
||||
case J.eitherDecode msgRaw of
|
||||
Left e -> do
|
||||
let err = ConnErrMsg $ "parsing ClientMessage failed: " <> T.pack e
|
||||
|
@ -164,7 +164,7 @@ setupAuthMode mAdminSecretHash mWebHook mJwtSecret mUnAuthRole httpManager logge
|
||||
-- header), do not start a background thread for refreshing the JWK
|
||||
getJwkFromUrl url = do
|
||||
ref <- liftIO $ newIORef $ JWKSet []
|
||||
maybeExpiry <- withJwkError $ Tracing.runTraceT "JWK init" $ updateJwkRef logger httpManager url ref
|
||||
maybeExpiry <- withJwkError $ Tracing.runTraceT "jwk init" $ updateJwkRef logger httpManager url ref
|
||||
case maybeExpiry of
|
||||
Nothing -> return ref
|
||||
Just time -> do
|
||||
|
@ -136,7 +136,7 @@ jwkRefreshCtrl
|
||||
-> m void
|
||||
jwkRefreshCtrl logger manager url ref time = do
|
||||
liftIO $ C.sleep time
|
||||
forever $ Tracing.runTraceT "JWK refresh" do
|
||||
forever $ Tracing.runTraceT "jwk refresh" do
|
||||
res <- runExceptT $ updateJwkRef logger manager url ref
|
||||
mTime <- either (const $ logNotice >> return Nothing) return res
|
||||
-- if can't parse time from header, defaults to 1 min
|
||||
|
@ -303,7 +303,7 @@ CREATE TABLE hdb_catalog.event_log
|
||||
tries INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
/* when locked IS NULL the event is unlocked and can be processed */
|
||||
locked TIMESTAMP,
|
||||
locked TIMESTAMPTZ,
|
||||
next_retry_at TIMESTAMP,
|
||||
archived BOOLEAN NOT NULL DEFAULT FALSE
|
||||
);
|
||||
|
@ -1,3 +1,3 @@
|
||||
ALTER TABLE hdb_catalog.event_log ALTER COLUMN locked DROP DEFAULT;
|
||||
ALTER TABLE hdb_catalog.event_log ALTER COLUMN locked DROP NOT NULL;
|
||||
ALTER TABLE hdb_catalog.event_log ALTER COLUMN locked TYPE TIMESTAMP USING CASE WHEN locked THEN NOW() ELSE NULL END;
|
||||
ALTER TABLE hdb_catalog.event_log ALTER COLUMN locked TYPE TIMESTAMPTZ USING CASE WHEN locked THEN NOW() ELSE NULL END;
|
Loading…
Reference in New Issue
Block a user