Skip to content

Commit

Permalink
Flush logs only in log write thread
Browse files Browse the repository at this point in the history
  • Loading branch information
ch1bo committed Mar 17, 2023
1 parent bbe90bf commit a2295a6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hydra-node/src/Hydra/Logging.hs
Expand Up @@ -49,6 +49,7 @@ import Data.Aeson (pairs, (.=))
import qualified Data.Aeson as Aeson
import qualified Data.ByteString.Lazy as LBS
import qualified Data.Text as Text
import Debug.Trace (traceIO)
import Test.QuickCheck.Instances.Text ()
import Test.QuickCheck.Instances.Time ()

Expand Down Expand Up @@ -105,7 +106,7 @@ withTracerOutputTo ::
withTracerOutputTo hdl namespace action = do
msgQueue <- newTBQueueIO @_ @(Envelope msg) defaultQueueSize
withAsync (writeLogs msgQueue `finally` flushLogs msgQueue) $ \_ ->
action (tracer msgQueue) `finally` flushLogs msgQueue
action (tracer msgQueue)
where
tracer queue =
Tracer $
Expand Down

0 comments on commit a2295a6

Please sign in to comment.