@@ -89,45 +89,40 @@ for (pk_name, uuid) in toplevel_pkgs
8989 end
9090end
9191
92- visited = Base. IdSet {Module} ([Base, Core])
93-
9492# Load all packages together
93+ # This is important, or methods added to functions in other packages that are loaded earlier would not be in the cache
9594for (i, uuid) in enumerate (packages_to_load)
9695 load_package (ctx, uuid, conn, LoadingBay, round (Int, 100 * (i - 1 )/ length (packages_to_load)))
96+ end
9797
98- # XXX : The following *may* duplicate some work, but we want to make sure that interrupts of
99- # the SymbolServer process don't invalidate *all* work done (which would happen when only
100- # writing the cache files out after all packages are loaded)
101-
102- # Create image of whole package env. This creates the module structure only.
103- env_symbols = getenvtree ()
104-
105- # Populate the above with symbols, skipping modules that don't need caching.
106- # symbols (env_symbols)
107- # don't need to cache these each time...
108- for (pid, m) in Base. loaded_modules
109- if pid. uuid != = nothing &&
110- is_stdlib (pid. uuid) &&
111- isinmanifest (ctx, pid. uuid) &&
112- isfile (joinpath (server. storedir, SymbolServer. get_cache_path (manifest (ctx), pid. uuid)... ))
113- push! (visited, m)
114- delete! (env_symbols, Symbol (pid. name))
115- end
116- end
98+ # Create image of whole package env. This creates the module structure only.
99+ env_symbols = getenvtree ()
117100
118- symbols (env_symbols, nothing , getallns (), visited)
101+ # Populate the above with symbols, skipping modules that don't need caching.
102+ # symbols (env_symbols)
103+ visited = Base. IdSet {Module} ([Base, Core])
119104
120- # Wrap the `ModuleStore`s as `Package`s.
121- for (pkg_name, cache) in env_symbols
122- ! isinmanifest (ctx, String (pkg_name)) && continue
123- uuid = packageuuid ( ctx, String (pkg_name ))
124- pe = frommanifest (ctx, uuid )
125- server . depot[uuid] = Package ( String (pkg_name), cache, uuid, sha_pkg (pe ))
105+ for (pid, m) in Base . loaded_modules
106+ if pid . uuid != = nothing && is_stdlib (pid . uuid) &&
107+ isinmanifest (ctx, pid . uuid) &&
108+ isfile ( joinpath (server . storedir, SymbolServer . get_cache_path ( manifest ( ctx), pid . uuid) ... ))
109+ push! (visited, m )
110+ delete! (env_symbols, Symbol (pid . name ))
126111 end
112+ end
127113
128- write_depot (server, server. context, written_caches)
114+ symbols (env_symbols, nothing , getallns (), visited)
115+
116+ # Wrap the `ModuleStore`s as `Package`s.
117+ for (pkg_name, cache) in env_symbols
118+ ! isinmanifest (ctx, String (pkg_name)) && continue
119+ uuid = packageuuid (ctx, String (pkg_name))
120+ pe = frommanifest (ctx, uuid)
121+ server. depot[uuid] = Package (String (pkg_name), cache, uuid, sha_pkg (pe))
129122end
130123
124+ write_depot (server, server. context, written_caches)
125+
131126@info " Symbol server indexing took $((time_ns () - start_time) / 1e9 ) seconds."
132127
133128println (conn, " DONE" )
0 commit comments