From 8b87a2874c860dba1c2ade99c1df2f4d44c33027 Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Tue, 21 Jan 2020 15:55:49 -0800 Subject: [PATCH] Introduce new config for unmarshal timeout --- src/Semantic/Config.hs | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/Semantic/Config.hs b/src/Semantic/Config.hs index 07a0fed5c..19069ef90 100644 --- a/src/Semantic/Config.hs +++ b/src/Semantic/Config.hs @@ -43,20 +43,21 @@ data FailOnParseError = FailOnParseError data Config = Config - { configAppName :: String -- ^ Application name ("semantic") - , configHostName :: String -- ^ HostName from getHostName - , configProcessID :: ProcessID -- ^ ProcessID from getProcessID - , configStatsHost :: Stat.Host -- ^ Host of statsd/datadog (default: "127.0.0.1") - , configStatsPort :: Stat.Port -- ^ Port of statsd/datadog (default: "28125") - , configTreeSitterParseTimeout :: Duration -- ^ Timeout in milliseconds before canceling tree-sitter parsing (default: 6000). - , configAssignmentTimeout :: Duration -- ^ Millisecond timeout for assignment (default: 4000) - , configMaxTelemetyQueueSize :: Int -- ^ Max size of telemetry queues before messages are dropped (default: 1000). - , configIsTerminal :: Flag IsTerminal -- ^ Whether a terminal is attached (set automaticaly at runtime). - , configLogPrintSource :: Flag LogPrintSource -- ^ Whether to print the source reference when logging errors (set automatically at runtime). - , configLogFormatter :: LogFormatter -- ^ Log formatter to use (set automatically at runtime). - , configSHA :: String -- ^ SHA to include in log messages (set automatically). - , configFailParsingForTesting :: Flag FailTestParsing -- ^ Simulate internal parse failure for testing (default: False). - , configOptions :: Options -- ^ Options configurable via command line arguments. + { configAppName :: String -- ^ Application name ("semantic") + , configHostName :: String -- ^ HostName from getHostName + , configProcessID :: ProcessID -- ^ ProcessID from getProcessID + , configStatsHost :: Stat.Host -- ^ Host of statsd/datadog (default: "127.0.0.1") + , configStatsPort :: Stat.Port -- ^ Port of statsd/datadog (default: "28125") + , configTreeSitterParseTimeout :: Duration -- ^ Timeout in milliseconds before canceling tree-sitter parsing (default: 6000). + , configTreeSitterUnmarshalTimeout :: Duration -- ^ Timeout in milliseconds before canceling tree-sitter unmarshalling (default: 4000). + , configAssignmentTimeout :: Duration -- ^ Millisecond timeout for assignment (default: 4000) + , configMaxTelemetyQueueSize :: Int -- ^ Max size of telemetry queues before messages are dropped (default: 1000). + , configIsTerminal :: Flag IsTerminal -- ^ Whether a terminal is attached (set automaticaly at runtime). + , configLogPrintSource :: Flag LogPrintSource -- ^ Whether to print the source reference when logging errors (set automatically at runtime). + , configLogFormatter :: LogFormatter -- ^ Log formatter to use (set automatically at runtime). + , configSHA :: String -- ^ SHA to include in log messages (set automatically). + , configFailParsingForTesting :: Flag FailTestParsing -- ^ Simulate internal parse failure for testing (default: False). + , configOptions :: Options -- ^ Options configurable via command line arguments. } -- Options configurable via command line arguments. @@ -85,6 +86,7 @@ defaultConfig options@Options{..} = do (statsHost, statsPort) <- lookupStatsAddr size <- envLookupNum 1000 "MAX_TELEMETRY_QUEUE_SIZE" parseTimeout <- envLookupNum 6000 "TREE_SITTER_PARSE_TIMEOUT" + unmarshalTimeout <- envLookupNum 4000 "TREE_SITTER_UNMARSHAL_TIMEOUT" assignTimeout <- envLookupNum 4000 "SEMANTIC_ASSIGNMENT_TIMEOUT" pure Config { configAppName = "semantic" @@ -94,6 +96,7 @@ defaultConfig options@Options{..} = do , configStatsPort = statsPort , configTreeSitterParseTimeout = fromMilliseconds parseTimeout + , configTreeSitterUnmarshalTimeout = fromMilliseconds unmarshalTimeout , configAssignmentTimeout = fromMilliseconds assignTimeout , configMaxTelemetyQueueSize = size , configIsTerminal = flag IsTerminal isTerminal