Skip to content

Replace deprecated redis calls in poem subscription example #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion poem/subscription-redis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ async-graphql = { path = "../../.." }
async-graphql-poem = { path = "../../../integrations/poem" }
tokio = { version = "1.8", features = ["macros", "rt-multi-thread"] }
poem = { version = "3.0.0", features = ["websocket"] }
redis = { version = "0.21.4", features = ["aio", "tokio-comp"] }
redis = { version = "0.25.2", features = ["aio", "tokio-comp"] }
futures-util = "0.3.19"
4 changes: 2 additions & 2 deletions poem/subscription-redis/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct MutationRoot;
impl MutationRoot {
async fn publish(&self, ctx: &Context<'_>, value: String) -> Result<bool> {
let client = ctx.data_unchecked::<Client>();
let mut conn = client.get_async_connection().await?;
let mut conn = client.get_multiplexed_async_connection().await?;
conn.publish("values", value).await?;
Ok(true)
}
Expand All @@ -31,7 +31,7 @@ struct SubscriptionRoot;
impl SubscriptionRoot {
async fn values(&self, ctx: &Context<'_>) -> Result<impl Stream<Item = String>> {
let client = ctx.data_unchecked::<Client>();
let mut conn = client.get_async_connection().await?.into_pubsub();
let mut conn = client.get_async_pubsub().await?;
conn.subscribe("values").await?;
Ok(conn
.into_on_message()
Expand Down