mirror of
https://github.com/denoland/deno.git
synced 2025-01-08 23:28:18 -05:00
Revert "perf(core): immediately schedule another tick if there are un… (#18718)
…polled ops (#18611)"
This reverts commit 4317055a3e
.
Reverting because we discovered while working on
https://github.com/denoland/deno/pull/18619 that it doesn't work
correctly (sometimes waker just stops working).
This commit is contained in:
parent
4e0bfafb24
commit
f9ae88c1b7
2 changed files with 134 additions and 141 deletions
|
@ -1,5 +1,4 @@
|
||||||
error: Uncaught (in worker "") Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag
|
error: Uncaught (in worker "") Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag
|
||||||
at data:application/javascript;base64,[WILDCARD]:1:8
|
at data:application/javascript;base64,[WILDCARD]:1:8
|
||||||
error: Uncaught (in promise) Error: Unhandled error in child worker.
|
error: Uncaught (in promise) Error: Unhandled error in child worker.
|
||||||
at Worker.#pollControl ([WILDCARD])
|
at Worker.#pollControl[WILDCARD]
|
||||||
at eventLoopTick (ext:core/01_core.js:[WILDCARD])
|
|
||||||
|
|
|
@ -1182,7 +1182,6 @@ impl JsRuntime {
|
||||||
state.waker.register(cx.waker());
|
state.waker.register(cx.waker());
|
||||||
}
|
}
|
||||||
|
|
||||||
loop {
|
|
||||||
if has_inspector {
|
if has_inspector {
|
||||||
// We poll the inspector first.
|
// We poll the inspector first.
|
||||||
let _ = self.inspector().borrow_mut().poll_unpin(cx);
|
let _ = self.inspector().borrow_mut().poll_unpin(cx);
|
||||||
|
@ -1242,8 +1241,7 @@ impl JsRuntime {
|
||||||
if has_inspector {
|
if has_inspector {
|
||||||
let inspector = self.inspector();
|
let inspector = self.inspector();
|
||||||
let has_active_sessions = inspector.borrow().has_active_sessions();
|
let has_active_sessions = inspector.borrow().has_active_sessions();
|
||||||
let has_blocking_sessions =
|
let has_blocking_sessions = inspector.borrow().has_blocking_sessions();
|
||||||
inspector.borrow().has_blocking_sessions();
|
|
||||||
|
|
||||||
if wait_for_inspector && has_active_sessions {
|
if wait_for_inspector && has_active_sessions {
|
||||||
// If there are no blocking sessions (eg. REPL) we can now notify
|
// If there are no blocking sessions (eg. REPL) we can now notify
|
||||||
|
@ -1265,18 +1263,15 @@ impl JsRuntime {
|
||||||
|
|
||||||
let state = self.state.borrow();
|
let state = self.state.borrow();
|
||||||
|
|
||||||
// Check if more async ops have been dispatched during this turn of
|
// Check if more async ops have been dispatched
|
||||||
// event loop. In such case immediately do another turn of the event loop.
|
// during this turn of event loop.
|
||||||
if state.have_unpolled_ops {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there are any pending background tasks, we also wake the runtime to
|
// If there are any pending background tasks, we also wake the runtime to
|
||||||
// make sure we don't miss them.
|
// make sure we don't miss them.
|
||||||
// TODO(andreubotella) The event loop will spin as long as there are pending
|
// TODO(andreubotella) The event loop will spin as long as there are pending
|
||||||
// background tasks. We should look into having V8 notify us when a
|
// background tasks. We should look into having V8 notify us when a
|
||||||
// background task is done.
|
// background task is done.
|
||||||
if pending_state.has_pending_background_tasks
|
if state.have_unpolled_ops
|
||||||
|
|| pending_state.has_pending_background_tasks
|
||||||
|| pending_state.has_tick_scheduled
|
|| pending_state.has_tick_scheduled
|
||||||
|| maybe_scheduling
|
|| maybe_scheduling
|
||||||
{
|
{
|
||||||
|
@ -1335,8 +1330,7 @@ impl JsRuntime {
|
||||||
state.waker.wake();
|
state.waker.wake();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
Poll::Pending
|
Poll::Pending
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue