diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2019-10-14 23:46:27 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-10-14 17:46:27 -0400 |
commit | 4221b90c3febbe03a4b47e47248263741a0fdd4a (patch) | |
tree | 0c16487c197863fb1223f37a9c589905517dfdcd /cli/lib.rs | |
parent | 605659535794ca0d8fe3ee4ea5857b418d7ce091 (diff) |
perf: eager poll async ops in Isolate (#3046)
Diffstat (limited to 'cli/lib.rs')
-rw-r--r-- | cli/lib.rs | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/cli/lib.rs b/cli/lib.rs index 8d0904ddb..3c093cda4 100644 --- a/cli/lib.rs +++ b/cli/lib.rs @@ -298,25 +298,31 @@ fn eval_command(flags: DenoFlags, argv: Vec<String>) { } fn bundle_command(flags: DenoFlags, argv: Vec<String>) { - let (mut _worker, state) = create_worker_and_state(flags, argv); + let (worker, state) = create_worker_and_state(flags, argv); let main_module = state.main_module().unwrap(); assert!(state.argv.len() >= 3); let out_file = state.argv[2].clone(); debug!(">>>>> bundle_async START"); - let bundle_future = state - .ts_compiler - .bundle_async(state.clone(), main_module.to_string(), out_file) - .map_err(|err| { - debug!("diagnostics returned, exiting!"); - eprintln!(""); - print_err_and_exit(err); + // NOTE: we need to poll `worker` otherwise TS compiler worker won't run properly + let main_future = lazy(move || { + worker.then(move |result| { + js_check(result); + state + .ts_compiler + .bundle_async(state.clone(), main_module.to_string(), out_file) + .map_err(|err| { + debug!("diagnostics returned, exiting!"); + eprintln!(""); + print_err_and_exit(err); + }) + .and_then(move |_| { + debug!(">>>>> bundle_async END"); + Ok(()) + }) }) - .and_then(move |_| { - debug!(">>>>> bundle_async END"); - Ok(()) - }); - tokio_util::run(bundle_future); + }); + tokio_util::run(main_future); } fn run_repl(flags: DenoFlags, argv: Vec<String>) { |