Skip to content

Commit 3efab99

Browse files
committed
only use Java primitives for parallel builds to avoid bad interactions with
downstream tooling (Figwheel etc.)
1 parent c98c0ee commit 3efab99

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/main/clojure/cljs/closure.clj

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
[java.net URL]
4848
[java.util.logging Level]
4949
[java.util List Random]
50-
[java.util.concurrent TimeUnit LinkedBlockingDeque]
50+
[java.util.concurrent
51+
TimeUnit LinkedBlockingDeque Executors CountDownLatch]
5152
[com.google.javascript.jscomp CompilerOptions CompilationLevel
5253
CompilerOptions$LanguageMode SourceMap$Format
5354
SourceMap$DetailLevel ClosureCodingConvention SourceFile
@@ -771,20 +772,16 @@
771772
(let [deque (LinkedBlockingDeque. inputs)
772773
input-set (atom (into #{} (comp (remove nil?) (map :ns)) inputs))
773774
cnt (+ 2 (.. Runtime getRuntime availableProcessors))
774-
agents (repeatedly cnt
775-
#(agent nil
776-
:error-handler
777-
(fn [err]
778-
(util/debug-prn err))))
775+
latch (CountDownLatch. cnt)
776+
es (Executors/newFixedThreadPool cnt)
779777
compiled (atom [])
780778
failed (atom false)]
781-
(doseq [agent agents]
782-
(send agent
783-
(fn [agent]
779+
(dotimes [_ cnt]
780+
(.execute es
781+
(bound-fn []
784782
(compile-task deque input-set compiled opts failed)
785-
agent)))
786-
(util/measure compiler-stats
787-
"Compile sources" (apply await agents))
783+
(.countDown latch))))
784+
(util/measure compiler-stats "Compile sources" (.await latch))
788785
@compiled))
789786

790787
(defn compile-sources

0 commit comments

Comments
 (0)