mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
fix(ext/node): do not exit worker thread when there is pending async op (#27378)
This change fixes the premature exit of worker threads when there are still remaining pending ops. This change reuses the idea of #22647 (unref'ing `op_worker_recv_message` in worker threads if closeOnIdle specified) and uses `web_worker.has_message_event_listener` check in the opposite way as #22944. (Now we continue the worker when `has_message_event_listener` is true instead of stopping it when `has_message_event_listener` is false. closes #23061 closes #26154
This commit is contained in:
parent
55d345baed
commit
350d9dce41
8 changed files with 49 additions and 38 deletions
|
@ -120,6 +120,7 @@ pub struct BootstrapOptions {
|
|||
pub serve_port: Option<u16>,
|
||||
pub serve_host: Option<String>,
|
||||
pub otel_config: OtelConfig,
|
||||
pub close_on_idle: bool,
|
||||
}
|
||||
|
||||
impl Default for BootstrapOptions {
|
||||
|
@ -155,6 +156,7 @@ impl Default for BootstrapOptions {
|
|||
serve_port: Default::default(),
|
||||
serve_host: Default::default(),
|
||||
otel_config: Default::default(),
|
||||
close_on_idle: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -198,6 +200,8 @@ struct BootstrapV8<'a>(
|
|||
Option<usize>,
|
||||
// OTEL config
|
||||
Box<[u8]>,
|
||||
// close on idle
|
||||
bool,
|
||||
);
|
||||
|
||||
impl BootstrapOptions {
|
||||
|
@ -225,6 +229,7 @@ impl BootstrapOptions {
|
|||
serve_is_main,
|
||||
serve_worker_count,
|
||||
self.otel_config.as_v8(),
|
||||
self.close_on_idle,
|
||||
);
|
||||
|
||||
bootstrap.serialize(ser).unwrap()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue