Skip to content

Commit

Permalink
Remove use of channel.
Browse files Browse the repository at this point in the history
  • Loading branch information
FireMasterK committed Nov 20, 2023
1 parent 830363c commit e945747
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Box<dyn Error>> {
}
}

let (tx, rx) = oneshot::channel::<String>();
spawn_blocking(move || {
let hash = spawn_blocking(move || {
let mut hasher = blake3::Hasher::new();

for (key, value) in set {
Expand All @@ -180,10 +179,8 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Box<dyn Error>> {

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());
Expand Down

0 comments on commit e945747

Please sign in to comment.