1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

Introduce new config for unmarshal timeout

This commit is contained in:
Timothy Clem 2020-01-21 15:55:49 -08:00
parent f4fbf51f49
commit 8b87a2874c

View File

@ -43,20 +43,21 @@ data FailOnParseError = FailOnParseError
data Config data Config
= Config = Config
{ configAppName :: String -- ^ Application name ("semantic") { configAppName :: String -- ^ Application name ("semantic")
, configHostName :: String -- ^ HostName from getHostName , configHostName :: String -- ^ HostName from getHostName
, configProcessID :: ProcessID -- ^ ProcessID from getProcessID , configProcessID :: ProcessID -- ^ ProcessID from getProcessID
, configStatsHost :: Stat.Host -- ^ Host of statsd/datadog (default: "127.0.0.1") , configStatsHost :: Stat.Host -- ^ Host of statsd/datadog (default: "127.0.0.1")
, configStatsPort :: Stat.Port -- ^ Port of statsd/datadog (default: "28125") , configStatsPort :: Stat.Port -- ^ Port of statsd/datadog (default: "28125")
, configTreeSitterParseTimeout :: Duration -- ^ Timeout in milliseconds before canceling tree-sitter parsing (default: 6000). , configTreeSitterParseTimeout :: Duration -- ^ Timeout in milliseconds before canceling tree-sitter parsing (default: 6000).
, configAssignmentTimeout :: Duration -- ^ Millisecond timeout for assignment (default: 4000) , configTreeSitterUnmarshalTimeout :: Duration -- ^ Timeout in milliseconds before canceling tree-sitter unmarshalling (default: 4000).
, configMaxTelemetyQueueSize :: Int -- ^ Max size of telemetry queues before messages are dropped (default: 1000). , configAssignmentTimeout :: Duration -- ^ Millisecond timeout for assignment (default: 4000)
, configIsTerminal :: Flag IsTerminal -- ^ Whether a terminal is attached (set automaticaly at runtime). , configMaxTelemetyQueueSize :: Int -- ^ Max size of telemetry queues before messages are dropped (default: 1000).
, configLogPrintSource :: Flag LogPrintSource -- ^ Whether to print the source reference when logging errors (set automatically at runtime). , configIsTerminal :: Flag IsTerminal -- ^ Whether a terminal is attached (set automaticaly at runtime).
, configLogFormatter :: LogFormatter -- ^ Log formatter to use (set automatically at runtime). , configLogPrintSource :: Flag LogPrintSource -- ^ Whether to print the source reference when logging errors (set automatically at runtime).
, configSHA :: String -- ^ SHA to include in log messages (set automatically). , configLogFormatter :: LogFormatter -- ^ Log formatter to use (set automatically at runtime).
, configFailParsingForTesting :: Flag FailTestParsing -- ^ Simulate internal parse failure for testing (default: False). , configSHA :: String -- ^ SHA to include in log messages (set automatically).
, configOptions :: Options -- ^ Options configurable via command line arguments. , 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. -- Options configurable via command line arguments.
@ -85,6 +86,7 @@ defaultConfig options@Options{..} = do
(statsHost, statsPort) <- lookupStatsAddr (statsHost, statsPort) <- lookupStatsAddr
size <- envLookupNum 1000 "MAX_TELEMETRY_QUEUE_SIZE" size <- envLookupNum 1000 "MAX_TELEMETRY_QUEUE_SIZE"
parseTimeout <- envLookupNum 6000 "TREE_SITTER_PARSE_TIMEOUT" parseTimeout <- envLookupNum 6000 "TREE_SITTER_PARSE_TIMEOUT"
unmarshalTimeout <- envLookupNum 4000 "TREE_SITTER_UNMARSHAL_TIMEOUT"
assignTimeout <- envLookupNum 4000 "SEMANTIC_ASSIGNMENT_TIMEOUT" assignTimeout <- envLookupNum 4000 "SEMANTIC_ASSIGNMENT_TIMEOUT"
pure Config pure Config
{ configAppName = "semantic" { configAppName = "semantic"
@ -94,6 +96,7 @@ defaultConfig options@Options{..} = do
, configStatsPort = statsPort , configStatsPort = statsPort
, configTreeSitterParseTimeout = fromMilliseconds parseTimeout , configTreeSitterParseTimeout = fromMilliseconds parseTimeout
, configTreeSitterUnmarshalTimeout = fromMilliseconds unmarshalTimeout
, configAssignmentTimeout = fromMilliseconds assignTimeout , configAssignmentTimeout = fromMilliseconds assignTimeout
, configMaxTelemetyQueueSize = size , configMaxTelemetyQueueSize = size
, configIsTerminal = flag IsTerminal isTerminal , configIsTerminal = flag IsTerminal isTerminal