diff --git a/change-notes/1.20/extractor-javascript.md b/change-notes/1.20/extractor-javascript.md index 5027573f30b3..b233e167faf7 100644 --- a/change-notes/1.20/extractor-javascript.md +++ b/change-notes/1.20/extractor-javascript.md @@ -18,7 +18,7 @@ ## Changes to code extraction -* Extraction of JavaScript files (but not TypeScript files) on LGTM is now parallelized. By default, the extractor uses as many threads as there are processors, but this can be overridden by setting the `LGTM_INDEX_THREADS` environment variable. In particular, setting `LGTM_INDEX_THREADS` to 1 disables parallel extraction. +* Parallel extraction of JavaScript files (but not TypeScript files) on LGTM is now supported. The `LGTM_THREADS` environment variable can be set to indicate how many files should be extracted in parallel. If this variable is not set, parallel extraction is disabled. * The extractor now offers experimental support for [E4X](https://developer.mozilla.org/en-US/docs/Archive/Web/E4X), a legacy language extension developed by Mozilla. * The extractor now supports additional [Flow](https://flow.org/) syntax. * The extractor now supports [Nullish Coalescing](https://github.com/tc39/proposal-nullish-coalescing) expressions. diff --git a/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java b/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java index 5d0b10361f9f..db865c97e0ca 100644 --- a/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java +++ b/javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java @@ -69,7 +69,7 @@ *
  • LGTM_INDEX_TYPESCRIPT: whether to extract TypeScript *
  • LGTM_INDEX_FILETYPES: a newline-separated list of ".extension:filetype" pairs * specifying which {@link FileType} to use for the given extension - *
  • LGTM_INDEX_THREADS: the maximum number of files to extract in parallel + *
  • LGTM_THREADS: the maximum number of files to extract in parallel *
  • LGTM_TRAP_CACHE: the path of a directory to use for trap caching *
  • LGTM_TRAP_CACHE_BOUND: the size to bound the trap cache to * @@ -163,9 +163,9 @@ * following environment variables are available: * * @@ -405,8 +405,8 @@ public void run() throws IOException { } private void startThreadPool() { - int defaultNumThreads = Runtime.getRuntime().availableProcessors(); - int numThreads = Env.systemEnv().getInt("LGTM_INDEX_THREADS", defaultNumThreads); + int defaultNumThreads = 1; + int numThreads = Env.systemEnv().getInt("LGTM_THREADS", defaultNumThreads); if (numThreads > 1) { System.out.println("Parallel extraction with " + numThreads + " threads."); threadPool = Executors.newFixedThreadPool(numThreads);