redis-api-update
Some checks failed
deploy / deploy (push) Failing after 4s

This commit is contained in:
2024-06-06 13:33:25 +03:00
parent d479e69193
commit d14e5457f3
3 changed files with 391 additions and 443 deletions

View File

@@ -57,7 +57,7 @@ async fn connect_handler(
ErrorUnauthorized("Unauthorized")
})?;
let mut con = state.redis.get_async_connection().await.map_err(|e| {
let mut con = state.redis.get_multiplexed_async_connection().await.map_err(|e| {
eprintln!("Failed to get async connection: {}", e);
ServerError("Internal Server Error")
})?;
@@ -80,8 +80,7 @@ async fn connect_handler(
let (tx, rx) = broadcast::channel(100);
let state_clone = state.clone();
let handle = tokio::spawn(async move {
let conn = state_clone.redis.get_async_connection().await.unwrap();
let mut pubsub = conn.into_pubsub();
let mut pubsub = state_clone.redis.get_async_pubsub().await.unwrap();
let followers_channel = format!("follower:{}", listener_id);
pubsub.subscribe(followers_channel.clone()).await.unwrap();
println!("'{}' pubsub subscribed", followers_channel);