Remove prepareEvents

This commit is contained in:
Phil Freeman 2020-07-30 12:33:43 -07:00
parent 8cc548abf0
commit b24af62628

View File

@ -368,7 +368,6 @@ runHGEServer env ServeOptions{..} InitCtx{..} pgExecCtx initTime shutdownApp pos
lockedEventsCtx <- liftIO $ atomically $ initLockedEventsCtx lockedEventsCtx <- liftIO $ atomically $ initLockedEventsCtx
-- prepare event triggers data -- prepare event triggers data
prepareEvents _icPgPool logger
eventEngineCtx <- liftIO $ atomically $ initEventEngineCtx maxEvThrds fetchI eventEngineCtx <- liftIO $ atomically $ initEventEngineCtx maxEvThrds fetchI
unLogger logger $ mkGenericStrLog LevelInfo "event_triggers" "starting workers" unLogger logger $ mkGenericStrLog LevelInfo "event_triggers" "starting workers"
@ -423,8 +422,10 @@ runHGEServer env ServeOptions{..} InitCtx{..} pgExecCtx initTime shutdownApp pos
liftIO $ Warp.runSettings warpSettings app liftIO $ Warp.runSettings warpSettings app
where where
-- | prepareEvents is a function to unlock all the events that are -- | prepareScheduledEvents is a function to unlock all the scheduled trigger
-- locked and unprocessed, which is called while hasura is started. -- events that are locked and unprocessed, which is called while hasura is
-- started.
--
-- Locked and unprocessed events can occur in 2 ways -- Locked and unprocessed events can occur in 2 ways
-- 1. -- 1.
-- Hasura's shutdown was not graceful in which all the fetched -- Hasura's shutdown was not graceful in which all the fetched
@ -434,12 +435,6 @@ runHGEServer env ServeOptions{..} InitCtx{..} pgExecCtx initTime shutdownApp pos
-- There is another hasura instance which is processing events and -- There is another hasura instance which is processing events and
-- it will lock events to process them. -- it will lock events to process them.
-- So, unlocking all the locked events might re-deliver an event(due to #2). -- So, unlocking all the locked events might re-deliver an event(due to #2).
prepareEvents pool (Logger logger) = do
liftIO $ logger $ mkGenericStrLog LevelInfo "event_triggers" "preparing data"
res <- liftIO $ runTx pool (Q.ReadCommitted, Nothing) unlockAllEvents
either (printErrJExit EventSubSystemError) return res
-- | prepareScheduledEvents is like prepareEvents, but for scheduled triggers
prepareScheduledEvents pool (Logger logger) = do prepareScheduledEvents pool (Logger logger) = do
liftIO $ logger $ mkGenericStrLog LevelInfo "scheduled_triggers" "preparing data" liftIO $ logger $ mkGenericStrLog LevelInfo "scheduled_triggers" "preparing data"
res <- liftIO $ runTx pool (Q.ReadCommitted, Nothing) unlockAllLockedScheduledEvents res <- liftIO $ runTx pool (Q.ReadCommitted, Nothing) unlockAllLockedScheduledEvents