Skip to content

Commit ebf070b

Browse files
committed
remove unwrap() on SimpleClient::exec
1 parent 0142f8f commit ebf070b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/cmd/connection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl Command for PingCommand {
9797
///
9898
/// #[ntex::main]
9999
/// async fn main() -> Result<(), Box<dyn std::error::Error>> {
100-
/// let redis = RedisConnector::new("127.0.0.1:6379").connect_simple().await?;
100+
/// let redis = RedisConnector::new("127.0.0.1:6379").connect().await?;
101101
///
102102
/// // reset connection
103103
/// let response = redis.exec(cmd::Reset()).await?;

src/simple.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ impl SimpleClient {
2626
U: Command,
2727
{
2828
self.send(cmd)?;
29-
self.recv::<U>().await.unwrap()
29+
loop {
30+
if let Some(result) = self.recv::<U>().await {
31+
return result;
32+
}
33+
}
3034
}
3135

3236
/// Send redis command

0 commit comments

Comments
 (0)