diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2024-05-16 00:09:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-16 07:09:35 +0000 |
commit | 88983fb3eb5a085f7d358a7a98d5c738a21b5d27 (patch) | |
tree | d4d83c5bd668edc25d30616fd4a3decc1cea3fb9 /cli/tools/bench/mod.rs | |
parent | bba553bea5938932518dc6382e464968ce8374b4 (diff) |
fix(node): seperate worker module cache (#23634)
Construct a new module graph container for workers instead of sharing it
with the main worker.
Fixes #17248
Fixes #23461
---------
Co-authored-by: David Sherret <dsherret@gmail.com>
Diffstat (limited to 'cli/tools/bench/mod.rs')
-rw-r--r-- | cli/tools/bench/mod.rs | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/cli/tools/bench/mod.rs b/cli/tools/bench/mod.rs index a6fb91776..dd94205cb 100644 --- a/cli/tools/bench/mod.rs +++ b/cli/tools/bench/mod.rs @@ -8,7 +8,6 @@ use crate::display::write_json_to_stdout; use crate::factory::CliFactory; use crate::factory::CliFactoryBuilder; use crate::graph_util::has_graph_root_local_dependent_changed; -use crate::module_loader::ModuleLoadPreparer; use crate::ops; use crate::tools::test::format_test_error; use crate::tools::test::TestFilter; @@ -145,24 +144,6 @@ fn create_reporter( Box::new(ConsoleReporter::new(show_output)) } -/// Type check a collection of module and document specifiers. -async fn check_specifiers( - cli_options: &CliOptions, - module_load_preparer: &ModuleLoadPreparer, - specifiers: Vec<ModuleSpecifier>, -) -> Result<(), AnyError> { - let lib = cli_options.ts_type_lib_window(); - module_load_preparer - .prepare_module_load( - specifiers, - false, - lib, - PermissionsContainer::allow_all(), - ) - .await?; - Ok(()) -} - /// Run a single specifier as an executable bench module. async fn bench_specifier( worker_factory: Arc<CliMainWorkerFactory>, @@ -445,12 +426,8 @@ pub async fn run_benchmarks( return Err(generic_error("No bench modules found")); } - check_specifiers( - cli_options, - factory.module_load_preparer().await?, - specifiers.clone(), - ) - .await?; + let main_graph_container = factory.main_module_graph_container().await?; + main_graph_container.check_specifiers(&specifiers).await?; if bench_options.no_run { return Ok(()); @@ -507,7 +484,6 @@ pub async fn run_benchmarks_with_watch( let graph_kind = cli_options.type_check_mode().as_graph_kind(); let module_graph_creator = factory.module_graph_creator().await?; - let module_load_preparer = factory.module_load_preparer().await?; let bench_modules = collect_specifiers( bench_options.files.clone(), @@ -559,7 +535,10 @@ pub async fn run_benchmarks_with_watch( .filter(|specifier| bench_modules_to_reload.contains(specifier)) .collect::<Vec<ModuleSpecifier>>(); - check_specifiers(cli_options, module_load_preparer, specifiers.clone()) + factory + .main_module_graph_container() + .await? + .check_specifiers(&specifiers) .await?; if bench_options.no_run { |