Skip to content

Commit a0fdba5

Browse files
committed
Use ntex-service 3.0
1 parent f741269 commit a0fdba5

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes
22

3+
## [2.0.0] - 2024-05-28
4+
5+
* Use ntex-service 3.0
6+
37
## [1.0.0] - 2024-01-09
48

59
* Fix decode array #8

Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ntex-redis"
3-
version = "1.0.0"
3+
version = "2.0.0"
44
authors = ["ntex contributors <[email protected]>"]
55
description = "Redis client"
66
documentation = "https://docs.rs/ntex-redis"
@@ -12,13 +12,13 @@ exclude = [".gitignore", ".travis.yml", ".cargo/config"]
1212
edition = "2018"
1313

1414
[dependencies]
15-
ntex = "1.0"
15+
ntex = "2"
1616
itoa = "1.0"
1717
btoi = "0.4"
1818
log = "0.4"
1919
derive_more = "0.99"
2020

2121
[dev-dependencies]
2222
rand = "0.8"
23-
env_logger = "0.10"
24-
ntex = { version = "1.0", features = ["tokio"] }
23+
env_logger = "0.11"
24+
ntex = { version = "2", features = ["tokio"] }

src/client.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::collections::VecDeque;
2-
use std::{cell::RefCell, fmt, future::poll_fn, rc::Rc, task::Context, task::Poll};
2+
use std::{cell::RefCell, fmt, future::poll_fn, rc::Rc, task::Poll};
33

44
use ntex::io::{IoBoxed, IoRef, OnDisconnect, RecvError};
55
use ntex::util::ready;
@@ -120,12 +120,15 @@ impl Service<Request> for Client {
120120
type Response = Response;
121121
type Error = Error;
122122

123-
fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
124-
if self.disconnect.poll_ready(cx).is_ready() {
125-
Poll::Ready(Err(Error::PeerGone(None)))
126-
} else {
127-
Poll::Ready(Ok(()))
128-
}
123+
async fn ready(&self, _: ServiceCtx<'_, Self>) -> Result<(), Self::Error> {
124+
poll_fn(|cx| {
125+
if self.disconnect.poll_ready(cx).is_ready() {
126+
Poll::Ready(Err(Error::PeerGone(None)))
127+
} else {
128+
Poll::Ready(Ok(()))
129+
}
130+
})
131+
.await
129132
}
130133

131134
async fn call(&self, req: Request, _: ServiceCtx<'_, Self>) -> Result<Response, Error> {

0 commit comments

Comments
 (0)