From a5830583afa0347d2e5f4cfc73f27b1e4cf84254 Mon Sep 17 00:00:00 2001 From: Yuki Kishimoto Date: Thu, 19 Sep 2024 10:27:47 -0400 Subject: [PATCH] pool: remove `Error::OneShotRecvError` variant Signed-off-by: Yuki Kishimoto --- CHANGELOG.md | 1 + crates/nostr-relay-pool/src/relay/error.rs | 3 --- crates/nostr-relay-pool/src/relay/internal.rs | 10 ++-------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5293ce95..7479cd850 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -145,6 +145,7 @@ * database: remove `Order` enum ([Yuki Kishimoto]) * database: remove `order` arg from `NostrDatabase::query` ([Yuki Kishimoto]) * pool: remove high latency log ([Yuki Kishimoto]) +* pool: remove `Error::OneShotRecvError` variant ([Yuki Kishimoto]) * zapper: remove `Err` from `NostrZapper` and unnecessary variants from `ZapperError` ([Yuki Kishimoto]) * js(nostr): remove `Keys::vanity` ([Yuki Kishimoto]) * cli: remove `reverse` flag from `query` command diff --git a/crates/nostr-relay-pool/src/relay/error.rs b/crates/nostr-relay-pool/src/relay/error.rs index 639b07e4b..5333c7301 100644 --- a/crates/nostr-relay-pool/src/relay/error.rs +++ b/crates/nostr-relay-pool/src/relay/error.rs @@ -77,9 +77,6 @@ pub enum Error { /// Batch event empty #[error("batch event cannot be empty")] BatchEventEmpty, - /// Impossible to receive oneshot message - #[error("impossible to recv msg")] - OneShotRecvError, /// Read actions disabled #[error("read actions are disabled for this relay")] ReadDisabled, diff --git a/crates/nostr-relay-pool/src/relay/internal.rs b/crates/nostr-relay-pool/src/relay/internal.rs index 7a6c28315..da3e81f36 100644 --- a/crates/nostr-relay-pool/src/relay/internal.rs +++ b/crates/nostr-relay-pool/src/relay/internal.rs @@ -1085,14 +1085,8 @@ impl InternalRelay { // Wait for oneshot reply match time::timeout(Some(opts.timeout), rx).await { Some(result) => match result { - Ok(val) => { - if val { - Ok(()) - } else { - Err(Error::MessageNotSent) - } - } - Err(_) => Err(Error::OneShotRecvError), + Ok(true) => Ok(()), + Ok(false) | Err(_) => Err(Error::MessageNotSent), }, None => Err(Error::RecvTimeout), }