From c2fda80dc6d753201dfa989125c15540fc8c4aad Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Tue, 27 Jun 2017 20:56:16 -0400 Subject: [PATCH] only broadcast using/import to nodes which need it fix #12381 fix #13999 --- base/loading.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/base/loading.jl b/base/loading.jl index 11f1fccbbb989..2f8dc463d6c26 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -316,11 +316,16 @@ Windows. """ function require(mod::Symbol) _require(mod) - # After successfully loading notify downstream consumers + # After successfully loading, notify downstream consumers if toplevel_load[] && myid() == 1 && nprocs() > 1 # broadcast top-level import/using from node 1 (only) @sync for p in procs() - p == 1 || @async remotecall_fetch(_require, p, mod) + p == 1 && continue + @async remotecall_wait(p) do + if !isbindingresolved(Main, mod) || !isdefined(Main, mod) + _require(mod) + end + end end end for callback in package_callbacks