refactor(test): use tokio::sync::mpsc::unbounded_channel (#13881)

This causes to block one less thread when running "deno test"
subcommand.
This commit is contained in:
Bartek Iwańczuk 2022-03-09 01:34:31 +01:00 committed by GitHub
parent 22dbbf75f3
commit 85cb6f2563
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View file

@ -8,10 +8,10 @@ use deno_core::OpState;
use deno_runtime::permissions::create_child_permissions;
use deno_runtime::permissions::ChildPermissionsArg;
use deno_runtime::permissions::Permissions;
use std::sync::mpsc::Sender;
use tokio::sync::mpsc::UnboundedSender;
use uuid::Uuid;
pub fn init(sender: Sender<TestEvent>) -> Extension {
pub fn init(sender: UnboundedSender<TestEvent>) -> Extension {
Extension::builder()
.ops(vec![
(
@ -84,7 +84,7 @@ fn op_dispatch_test_event(
event: TestEvent,
_: (),
) -> Result<(), AnyError> {
let sender = state.borrow::<Sender<TestEvent>>().clone();
let sender = state.borrow::<UnboundedSender<TestEvent>>().clone();
sender.send(event).ok();
Ok(())