mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-09-20 06:58:39 +03:00
* flush log buffer on exception in mkWaiApp * add comment to explain the introduced change * add changelog
This commit is contained in:
parent
a8699bb442
commit
9c55940b6d
@ -56,6 +56,7 @@ Read more about the session argument for computed fields in the [docs](https://h
|
||||
- server: fix mishandling of GeoJSON inputs in subscriptions (fix #3239)
|
||||
- server: fix importing of allow list query from metadata (fix #4687)
|
||||
- server: flush log buffer during shutdown (#4800)
|
||||
- server: fix edge case with printing logs on startup failure (fix #4772)
|
||||
- console: avoid count queries for large tables (#4692)
|
||||
- console: add read replica support section to pro popup (#4118)
|
||||
- console: allow modifying default value for PK (fix #4075) (#4679)
|
||||
|
@ -5,6 +5,7 @@ module Hasura.App where
|
||||
|
||||
import Control.Concurrent.STM.TVar (readTVarIO)
|
||||
import Control.Monad.Base
|
||||
import Control.Monad.Catch (MonadCatch, MonadThrow, onException)
|
||||
import Control.Monad.Stateless
|
||||
import Control.Monad.STM (atomically)
|
||||
import Control.Monad.Trans.Control (MonadBaseControl (..))
|
||||
@ -28,6 +29,7 @@ import qualified Database.PG.Query as Q
|
||||
import qualified Network.HTTP.Client as HTTP
|
||||
import qualified Network.HTTP.Client.TLS as HTTP
|
||||
import qualified Network.Wai.Handler.Warp as Warp
|
||||
import qualified System.Log.FastLogger as FL
|
||||
import qualified System.Posix.Signals as Signals
|
||||
import qualified Text.Mustache.Compile as M
|
||||
|
||||
@ -126,7 +128,7 @@ data Loggers
|
||||
}
|
||||
|
||||
newtype AppM a = AppM { unAppM :: IO a }
|
||||
deriving (Functor, Applicative, Monad, MonadIO, MonadBase IO, MonadBaseControl IO)
|
||||
deriving (Functor, Applicative, Monad, MonadIO, MonadBase IO, MonadBaseControl IO, MonadCatch, MonadThrow)
|
||||
|
||||
-- | this function initializes the catalog and returns an @InitCtx@, based on the command given
|
||||
-- - for serve command it creates a proper PG connection pool
|
||||
@ -185,6 +187,7 @@ runTxIO pool isoLevel tx = do
|
||||
runHGEServer
|
||||
:: ( HasVersion
|
||||
, MonadIO m
|
||||
, MonadCatch m
|
||||
, MonadStateless IO m
|
||||
, UserAuthentication m
|
||||
, MetadataApiAuthorization m
|
||||
@ -213,7 +216,11 @@ runHGEServer ServeOptions{..} InitCtx{..} initTime = do
|
||||
|
||||
authMode <- either (printErrExit . T.unpack) return authModeRes
|
||||
|
||||
HasuraApp app cacheRef cacheInitTime shutdownApp <-
|
||||
-- If an exception is encountered in 'mkWaiApp', flush the log buffer and rethrow
|
||||
-- If we do not flush the log buffer on exception, then log lines written in 'mkWaiApp' may be missed
|
||||
-- See: https://github.com/hasura/graphql-engine/issues/4772
|
||||
let flushLogger = liftIO $ FL.flushLogStr $ _lcLoggerSet loggerCtx
|
||||
HasuraApp app cacheRef cacheInitTime shutdownApp <- flip onException flushLogger $
|
||||
mkWaiApp soTxIso
|
||||
logger
|
||||
sqlGenCtx
|
||||
|
Loading…
Reference in New Issue
Block a user