From c6bb3d5a10ba8acceadcaa66050abcaefb7bc0bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 22 Nov 2019 18:46:57 +0100 Subject: remove tokio_util::block_on (#3388) This PR removes tokio_util::block_on - refactored compiler and file fetcher slightly so that we can safely block there - that's because only blocking path consist of only synchronous operations. Additionally I removed excessive use of tokio_util::panic_on_error and tokio_util::run_in_task and moved both functions to cli/worker.rs, to tests module. Closes #2960 --- cli/compilers/ts.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'cli/compilers') diff --git a/cli/compilers/ts.rs b/cli/compilers/ts.rs index c255e18be..ff5405f52 100644 --- a/cli/compilers/ts.rs +++ b/cli/compilers/ts.rs @@ -473,7 +473,7 @@ impl TsCompiler { let source_file = self .file_fetcher - .fetch_source_file(&module_specifier) + .fetch_cached_source_file(&module_specifier) .expect("Source file not found"); let version_hash = source_code_version_hash( @@ -581,10 +581,9 @@ impl TsCompiler { script_name: &str, ) -> Option { if let Some(module_specifier) = self.try_to_resolve(script_name) { - return match self.file_fetcher.fetch_source_file(&module_specifier) { - Ok(out) => Some(out), - Err(_) => None, - }; + return self + .file_fetcher + .fetch_cached_source_file(&module_specifier); } None -- cgit v1.2.3