From 08bb8b3d53eb2445de9b5e2845ab8acf9d353800 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sat, 10 Oct 2020 05:41:11 -0400 Subject: Fix 100% CPU idling problem by reverting #7672 (#7911) * Revert "refactor: Worker is not a Future (#7895)" This reverts commit f4357f0ff9d39411f22504fcc20db6bd5dec6ddb. * Revert "refactor(core): JsRuntime is not a Future (#7855)" This reverts commit d8879feb8c832dbb38649551b1cb0730874f7be6. * Revert "fix(core): module execution with top level await (#7672)" This reverts commit c7c767782538243ded64742dca9b34d6af74d62d. --- core/modules.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'core/modules.rs') diff --git a/core/modules.rs b/core/modules.rs index 1038dd84f..130becab8 100644 --- a/core/modules.rs +++ b/core/modules.rs @@ -341,13 +341,6 @@ pub struct ModuleInfo { pub name: String, pub handle: v8::Global, pub import_specifiers: Vec, - // TODO(bartlomieju): there should be "state" - // field that describes if module is already being loaded, - // so concurent dynamic imports don't introduce dead lock - // pub state: LoadState { - // Loading(shared_future), - // Loaded, - // }, } /// A symbolic module entity. @@ -674,7 +667,7 @@ mod tests { let a_id_fut = runtime.load_module(&spec, None); let a_id = futures::executor::block_on(a_id_fut).expect("Failed to load"); - futures::executor::block_on(runtime.mod_evaluate(a_id)).unwrap(); + runtime.mod_evaluate(a_id).unwrap(); let l = loads.lock().unwrap(); assert_eq!( l.to_vec(), @@ -741,7 +734,7 @@ mod tests { let result = runtime.load_module(&spec, None).await; assert!(result.is_ok()); let circular1_id = result.unwrap(); - runtime.mod_evaluate(circular1_id).await.unwrap(); + runtime.mod_evaluate(circular1_id).unwrap(); let l = loads.lock().unwrap(); assert_eq!( @@ -818,7 +811,7 @@ mod tests { println!(">> result {:?}", result); assert!(result.is_ok()); let redirect1_id = result.unwrap(); - runtime.mod_evaluate(redirect1_id).await.unwrap(); + runtime.mod_evaluate(redirect1_id).unwrap(); let l = loads.lock().unwrap(); assert_eq!( l.to_vec(), @@ -968,7 +961,7 @@ mod tests { let main_id = futures::executor::block_on(main_id_fut).expect("Failed to load"); - futures::executor::block_on(runtime.mod_evaluate(main_id)).unwrap(); + runtime.mod_evaluate(main_id).unwrap(); let l = loads.lock().unwrap(); assert_eq!( -- cgit v1.2.3