From 2aa3053d34881d767e3a4498e3da1bebf7f64da5 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Mon, 20 Nov 2023 05:20:35 +0000 Subject: [PATCH] Remove use of channel. --- src/main.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 94748ef..7ab9180 100644 --- a/src/main.rs +++ b/src/main.rs @@ -167,8 +167,7 @@ async fn index(req: HttpRequest) -> Result> { } } - let (tx, rx) = oneshot::channel::(); - spawn_blocking(move || { + let hash = spawn_blocking(move || { let mut hasher = blake3::Hasher::new(); for (key, value) in set { @@ -180,10 +179,8 @@ async fn index(req: HttpRequest) -> Result> { let hash = hasher.finalize().to_hex(); let hash = hash[..8].to_owned(); - tx.send(hash).unwrap(); - }); - - let hash = rx.await.unwrap(); + hash + }).await.unwrap(); if hash != qhash { return Err("Invalid qhash provided".into());