summaryrefslogtreecommitdiff
path: root/cli/repl.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-10-10 05:41:11 -0400
committerGitHub <noreply@github.com>2020-10-10 11:41:11 +0200
commit08bb8b3d53eb2445de9b5e2845ab8acf9d353800 (patch)
treeebf00cb815ee1a10be00c74cbb332af33dd52dc2 /cli/repl.rs
parent782e6a2ed5d76bb5a154c56d7daf4607e5bdb93f (diff)
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.
Diffstat (limited to 'cli/repl.rs')
-rw-r--r--cli/repl.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/cli/repl.rs b/cli/repl.rs
index c5107d5af..fbc37fac5 100644
--- a/cli/repl.rs
+++ b/cli/repl.rs
@@ -47,7 +47,7 @@ async fn post_message_and_poll(
return result
}
- _ = worker.run_event_loop() => {
+ _ = &mut *worker => {
// A zero delay is long enough to yield the thread in order to prevent the loop from
// running hot for messages that are taking longer to resolve like for example an
// evaluation of top level await.
@@ -75,7 +75,7 @@ async fn read_line_and_poll(
result = &mut line => {
return result.unwrap();
}
- _ = worker.run_event_loop(), if poll_worker => {
+ _ = &mut *worker, if poll_worker => {
poll_worker = false;
}
_ = &mut timeout => {
@@ -92,7 +92,12 @@ pub async fn run(
// Our inspector is unable to default to the default context id so we have to specify it here.
let context_id: u32 = 1;
- let mut session = worker.create_inspector_session();
+ let inspector = worker
+ .inspector
+ .as_mut()
+ .expect("Inspector is not created.");
+
+ let mut session = InspectorSession::new(&mut **inspector);
let history_file = global_state.dir.root.join("deno_history.txt");