From f7077f423f24458db5a5162c0dc7f7bfefcdbb25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=92=E9=87=8E=E7=84=A1=E7=87=88?= Date: Sun, 19 Dec 2021 00:07:19 +0800 Subject: [PATCH 1/6] chore: update redis crate to 0.21.4 --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e3da58f..a304d8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,11 +12,11 @@ keywords = ["sessions", "tide", "async-session", "redis"] categories = ["web-programming::http-server", "web-programming", "database"] [dependencies.redis] -version = "0.21.0" +version = "0.21.4" features = ["aio", "async-std-comp"] [dependencies] async-session = "3.0.0" [dev-dependencies] -async-std = { version = "1.9.0", features = ["attributes"] } +async-std = { version = "1.10.0", features = ["attributes"] } From 5cbc391bc6ace6e9c67bae97dffcfb7401108a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=92=E9=87=8E=E7=84=A1=E7=87=88?= Date: Mon, 20 Dec 2021 02:26:05 +0800 Subject: [PATCH 2/6] refactor: use tokio runtime for redis crate --- Cargo.toml | 2 +- src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a304d8d..db5f6dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ categories = ["web-programming::http-server", "web-programming", "database"] [dependencies.redis] version = "0.21.4" -features = ["aio", "async-std-comp"] +features = ["aio", "tokio-comp", "connection-manager"] [dependencies] async-session = "3.0.0" diff --git a/src/lib.rs b/src/lib.rs index 0241b08..d70cfb5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -109,7 +109,7 @@ impl RedisSessionStore { } async fn connection(&self) -> RedisResult { - self.client.get_async_std_connection().await + self.client.get_async_connection().await } } From dd92c22246fa77f2d4406d3729453987099fffc8 Mon Sep 17 00:00:00 2001 From: ttyS3 Date: Thu, 20 Oct 2022 04:17:25 +0800 Subject: [PATCH 3/6] chore: update to redis 0.22.0 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index db5f6dd..ef7fca2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ keywords = ["sessions", "tide", "async-session", "redis"] categories = ["web-programming::http-server", "web-programming", "database"] [dependencies.redis] -version = "0.21.4" +version = "0.22.0" features = ["aio", "tokio-comp", "connection-manager"] [dependencies] From 6b4a7a43f887c8b38240325936c8a7c68d8de2fc Mon Sep 17 00:00:00 2001 From: ttyS3 Date: Thu, 20 Oct 2022 04:24:39 +0800 Subject: [PATCH 4/6] test: using tokio --- Cargo.toml | 2 +- src/lib.rs | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ef7fca2..5c467df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,4 +19,4 @@ features = ["aio", "tokio-comp", "connection-manager"] async-session = "3.0.0" [dev-dependencies] -async-std = { version = "1.10.0", features = ["attributes"] } +tokio = { version = "1.21", features = ["full", "tracing"] } diff --git a/src/lib.rs b/src/lib.rs index d70cfb5..c44e8c7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -155,6 +155,7 @@ impl SessionStore for RedisSessionStore { let mut connection = self.connection().await?; if self.prefix.is_none() { + // TODO Oops, we're clearing the whole database, this should not happen let _: () = redis::cmd("FLUSHDB").query_async(&mut connection).await?; } else { let ids = self.ids().await?; @@ -169,8 +170,8 @@ impl SessionStore for RedisSessionStore { #[cfg(test)] mod tests { use super::*; - use async_std::task; use std::time::Duration; + use tokio::time; async fn test_store() -> RedisSessionStore { let store = RedisSessionStore::new("redis://127.0.0.1").unwrap(); @@ -178,7 +179,7 @@ mod tests { store } - #[async_std::test] + #[tokio::test] async fn creating_a_new_session_with_no_expiry() -> Result { let store = test_store().await; let mut session = Session::new(); @@ -194,7 +195,7 @@ mod tests { Ok(()) } - #[async_std::test] + #[tokio::test] async fn updating_a_session() -> Result { let store = test_store().await; let mut session = Session::new(); @@ -213,7 +214,7 @@ mod tests { Ok(()) } - #[async_std::test] + #[tokio::test] async fn updating_a_session_extending_expiry() -> Result { let store = test_store().await; let mut session = Session::new(); @@ -237,13 +238,13 @@ mod tests { assert_eq!(1, store.count().await.unwrap()); - task::sleep(Duration::from_secs(10)).await; + time::sleep(Duration::from_secs(10)).await; assert_eq!(0, store.count().await.unwrap()); Ok(()) } - #[async_std::test] + #[tokio::test] async fn creating_a_new_session_with_expiry() -> Result { let store = test_store().await; let mut session = Session::new(); @@ -261,13 +262,13 @@ mod tests { assert!(!loaded_session.is_expired()); - task::sleep(Duration::from_secs(2)).await; + time::sleep(Duration::from_secs(2)).await; assert_eq!(None, store.load_session(cookie_value).await?); Ok(()) } - #[async_std::test] + #[tokio::test] async fn destroying_a_single_session() -> Result { let store = test_store().await; for _ in 0..3i8 { @@ -286,7 +287,7 @@ mod tests { Ok(()) } - #[async_std::test] + #[tokio::test] async fn clearing_the_whole_store() -> Result { let store = test_store().await; for _ in 0..3i8 { @@ -300,7 +301,7 @@ mod tests { Ok(()) } - #[async_std::test] + #[tokio::test] async fn prefixes() -> Result { test_store().await; // clear the db From fd3ffb1ee3dab206867f5cc50860ab10e35e3b36 Mon Sep 17 00:00:00 2001 From: Erik Wegner Date: Mon, 21 Nov 2022 08:09:03 +0100 Subject: [PATCH 5/6] Version increased Crate patch version increased Redis dependency patch version increased --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5c467df..c86ae35 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "async-redis-session" -version = "0.2.2" +version = "0.2.3" authors = ["Jacob Rothstein "] edition = "2018" description = "redis session store for async-session" @@ -12,7 +12,7 @@ keywords = ["sessions", "tide", "async-session", "redis"] categories = ["web-programming::http-server", "web-programming", "database"] [dependencies.redis] -version = "0.22.0" +version = "0.22.1" features = ["aio", "tokio-comp", "connection-manager"] [dependencies] From 99a21efb4aac7904c2e3f628689a4e66ac94d6aa Mon Sep 17 00:00:00 2001 From: Erik Wegner Date: Tue, 12 Sep 2023 11:05:28 +0200 Subject: [PATCH 6/6] Upgrade redis crate --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index c86ae35..b7b7d91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ keywords = ["sessions", "tide", "async-session", "redis"] categories = ["web-programming::http-server", "web-programming", "database"] [dependencies.redis] -version = "0.22.1" +version = "0.23.3" features = ["aio", "tokio-comp", "connection-manager"] [dependencies]