summaryrefslogtreecommitdiff
path: root/runtime/worker.rs
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2021-07-30 13:36:43 +0200
committerGitHub <noreply@github.com>2021-07-30 13:36:43 +0200
commitc909faf9e6cd2964398da7c0852d0229cdd1a22b (patch)
tree033eb0e7edf86f120b9d96a8f591586d5b46e203 /runtime/worker.rs
parent2b13bb694532904704c16bec4e8a47c386e681e2 (diff)
chore(core): use oneshot channel in mod_evaluate() (#11556)
Oneshot is more appropriate because mod_evaluate() only sends a single value. It also makes it easier to use it correctly. As an embedder, I wasn't sure if I'm expected to drain the channel or not.
Diffstat (limited to 'runtime/worker.rs')
-rw-r--r--runtime/worker.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/runtime/worker.rs b/runtime/worker.rs
index f7287cfbb..94edd6f1e 100644
--- a/runtime/worker.rs
+++ b/runtime/worker.rs
@@ -7,7 +7,6 @@ use crate::ops;
use crate::permissions::Permissions;
use deno_broadcast_channel::InMemoryBroadcastChannel;
use deno_core::error::AnyError;
-use deno_core::futures::stream::StreamExt;
use deno_core::futures::Future;
use deno_core::located_script_name;
use deno_core::serde_json;
@@ -218,14 +217,14 @@ impl MainWorker {
self.wait_for_inspector_session();
let mut receiver = self.js_runtime.mod_evaluate(id);
tokio::select! {
- maybe_result = receiver.next() => {
+ maybe_result = &mut receiver => {
debug!("received module evaluate {:#?}", maybe_result);
maybe_result.expect("Module evaluation result not provided.")
}
event_loop_result = self.run_event_loop(false) => {
event_loop_result?;
- let maybe_result = receiver.next().await;
+ let maybe_result = receiver.await;
maybe_result.expect("Module evaluation result not provided.")
}
}