1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -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:
Bartek Iwańczuk 2023-04-16 16:05:13 +02:00 committed by GitHub
parent 2184103a5e
commit 1564595f6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 134 additions and 141 deletions

View file

@ -1,5 +1,4 @@
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
error: Uncaught (in promise) Error: Unhandled error in child worker.
at Worker.#pollControl ([WILDCARD])
at eventLoopTick (ext:core/01_core.js:[WILDCARD])
at Worker.#pollControl[WILDCARD]

View file

@ -1182,7 +1182,6 @@ impl JsRuntime {
state.waker.register(cx.waker());
}
loop {
if has_inspector {
// We poll the inspector first.
let _ = self.inspector().borrow_mut().poll_unpin(cx);
@ -1242,8 +1241,7 @@ impl JsRuntime {
if has_inspector {
let inspector = self.inspector();
let has_active_sessions = inspector.borrow().has_active_sessions();
let has_blocking_sessions =
inspector.borrow().has_blocking_sessions();
let has_blocking_sessions = inspector.borrow().has_blocking_sessions();
if wait_for_inspector && has_active_sessions {
// If there are no blocking sessions (eg. REPL) we can now notify
@ -1265,18 +1263,15 @@ impl JsRuntime {
let state = self.state.borrow();
// Check if more async ops have been dispatched during this turn of
// event loop. In such case immediately do another turn of the event loop.
if state.have_unpolled_ops {
continue;
}
// Check if more async ops have been dispatched
// during this turn of event loop.
// If there are any pending background tasks, we also wake the runtime to
// make sure we don't miss them.
// 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 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
|| maybe_scheduling
{
@ -1335,8 +1330,7 @@ impl JsRuntime {
state.waker.wake();
}
}
break;
}
Poll::Pending
}