From d1b88510cf31e1a9e5218f3195d15390e904f38a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 21 Sep 2020 11:41:51 +0200 Subject: [PATCH] refactor: remove GlobalState::compile_lock (#7598) --- cli/global_state.rs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/cli/global_state.rs b/cli/global_state.rs index 52bf4859..9205b405 100644 --- a/cli/global_state.rs +++ b/cli/global_state.rs @@ -19,7 +19,6 @@ use std::env; use std::sync::atomic::AtomicUsize; use std::sync::Arc; use std::sync::Mutex; -use tokio::sync::Mutex as AsyncMutex; pub fn exit_unstable(api_name: &str) { eprintln!( @@ -43,7 +42,6 @@ pub struct GlobalState { pub lockfile: Option>, pub compiler_starts: AtomicUsize, pub maybe_import_map: Option, - compile_lock: AsyncMutex<()>, } impl GlobalState { @@ -96,7 +94,6 @@ impl GlobalState { lockfile, maybe_import_map, compiler_starts: AtomicUsize::new(0), - compile_lock: AsyncMutex::new(()), }; Ok(Arc::new(global_state)) } @@ -116,10 +113,6 @@ impl GlobalState { ) -> Result<(), AnyError> { let module_specifier = module_specifier.clone(); - // TODO(ry) Try to lift compile_lock as high up in the call stack for - // sanity. - let compile_lock = self.compile_lock.lock().await; - let mut module_graph_loader = ModuleGraphLoader::new( self.file_fetcher.clone(), maybe_import_map, @@ -180,8 +173,6 @@ impl GlobalState { g.write()?; } - drop(compile_lock); - Ok(()) } @@ -195,17 +186,11 @@ impl GlobalState { module_specifier: ModuleSpecifier, _maybe_referrer: Option, ) -> Result { - let module_specifier = module_specifier.clone(); - let out = self .file_fetcher .fetch_cached_source_file(&module_specifier, Permissions::allow_all()) .expect("Cached source file doesn't exist"); - // TODO(ry) Try to lift compile_lock as high up in the call stack for - // sanity. - let compile_lock = self.compile_lock.lock().await; - // Check if we need to compile files let was_compiled = match out.media_type { MediaType::TypeScript | MediaType::TSX | MediaType::JSX => true, @@ -237,8 +222,6 @@ impl GlobalState { } }; - drop(compile_lock); - Ok(compiled_module) } -- GitLab