mirror of
https://github.com/github/semantic.git
synced 2025-01-01 19:55:34 +03:00
Merge branch 'master' into streamline-toc-summaries
This commit is contained in:
commit
0edad11aef
@ -38,6 +38,7 @@ data Config
|
|||||||
, 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: 10000).
|
, configTreeSitterParseTimeout :: Duration -- ^ Timeout in milliseconds before canceling tree-sitter parsing (default: 10000).
|
||||||
|
, configAssignmentTimeout :: Duration -- ^ Millisecond timeout for assignment (default: 10000)
|
||||||
, configMaxTelemetyQueueSize :: Int -- ^ Max size of telemetry queues before messages are dropped (default: 1000).
|
, configMaxTelemetyQueueSize :: Int -- ^ Max size of telemetry queues before messages are dropped (default: 1000).
|
||||||
, configIsTerminal :: Bool -- ^ Whether a terminal is attached (set automaticaly at runtime).
|
, configIsTerminal :: Bool -- ^ Whether a terminal is attached (set automaticaly at runtime).
|
||||||
, configLogPrintSource :: Bool -- ^ Whether to print the source reference when logging errors (set automatically at runtime).
|
, configLogPrintSource :: Bool -- ^ Whether to print the source reference when logging errors (set automatically at runtime).
|
||||||
@ -70,7 +71,9 @@ defaultConfig options@Options{..} = do
|
|||||||
haystackURL <- lookupEnv "HAYSTACK_URL"
|
haystackURL <- lookupEnv "HAYSTACK_URL"
|
||||||
(statsHost, statsPort) <- lookupStatsAddr
|
(statsHost, statsPort) <- lookupStatsAddr
|
||||||
size <- envLookupNum 1000 "MAX_TELEMETRY_QUEUE_SIZE"
|
size <- envLookupNum 1000 "MAX_TELEMETRY_QUEUE_SIZE"
|
||||||
parseTimeout <- envLookupNum 10000 "TREE_SITTER_PARSE_TIMEOUT" -- Default is 10 seconds
|
-- Defaults for these values are commensurate with the Dockerfile
|
||||||
|
parseTimeout <- envLookupNum 6000 "TREE_SITTER_PARSE_TIMEOUT"
|
||||||
|
assignTimeout <- envLookupNum 4000 "SEMANTIC_ASSIGNMENT_TIMEOUT"
|
||||||
pure Config
|
pure Config
|
||||||
{ configAppName = "semantic"
|
{ configAppName = "semantic"
|
||||||
, configHostName = hostName
|
, configHostName = hostName
|
||||||
@ -80,6 +83,7 @@ defaultConfig options@Options{..} = do
|
|||||||
, configStatsPort = statsPort
|
, configStatsPort = statsPort
|
||||||
|
|
||||||
, configTreeSitterParseTimeout = fromMilliseconds parseTimeout
|
, configTreeSitterParseTimeout = fromMilliseconds parseTimeout
|
||||||
|
, configAssignmentTimeout = fromMilliseconds assignTimeout
|
||||||
, configMaxTelemetyQueueSize = size
|
, configMaxTelemetyQueueSize = size
|
||||||
, configIsTerminal = isTerminal
|
, configIsTerminal = isTerminal
|
||||||
, configLogPrintSource = isTerminal
|
, configLogPrintSource = isTerminal
|
||||||
|
@ -72,7 +72,6 @@ import Data.Bool
|
|||||||
import Data.ByteString.Builder
|
import Data.ByteString.Builder
|
||||||
import Data.Coerce
|
import Data.Coerce
|
||||||
import Data.Diff
|
import Data.Diff
|
||||||
import Data.Duration
|
|
||||||
import qualified Data.Error as Error
|
import qualified Data.Error as Error
|
||||||
import Data.Language (Language)
|
import Data.Language (Language)
|
||||||
import Data.Location
|
import Data.Location
|
||||||
@ -328,8 +327,7 @@ runParser blob@Blob{..} parser = case parser of
|
|||||||
writeLog Error "failed parsing" (("task", "parse") : blobFields)
|
writeLog Error "failed parsing" (("task", "parse") : blobFields)
|
||||||
throwError (toException err)
|
throwError (toException err)
|
||||||
|
|
||||||
-- TODO: Could give assignment a dedicated config for it's timeout.
|
res <- timeout (configAssignmentTimeout config) . time "parse.assign" languageTag $
|
||||||
res <- timeout (fromSeconds 3) . time "parse.assign" languageTag $
|
|
||||||
case assign blobSource assignment ast of
|
case assign blobSource assignment ast of
|
||||||
Left err -> do
|
Left err -> do
|
||||||
writeStat (increment "parse.assign_errors" languageTag)
|
writeStat (increment "parse.assign_errors" languageTag)
|
||||||
|
Loading…
Reference in New Issue
Block a user