fixes-23
This commit is contained in:
parent
1f3019ea1a
commit
9e181fe303
13
src/main.rs
13
src/main.rs
|
@ -10,7 +10,6 @@ use futures::StreamExt;
|
|||
use tokio::sync::broadcast::{self, Receiver};
|
||||
use uuid::Uuid;
|
||||
use chrono::Utc;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
|
@ -83,7 +82,7 @@ async fn create_first_chat(author_id: i32, con: &mut redis::aio::Connection) ->
|
|||
.query_async(con)
|
||||
.await?;
|
||||
|
||||
Ok(vec![chat.to_string()])
|
||||
Ok(vec![chat_id, ])
|
||||
}
|
||||
|
||||
async fn sse_handler(
|
||||
|
@ -142,14 +141,12 @@ async fn sse_handler(
|
|||
};
|
||||
|
||||
let mut pubsub = con.into_pubsub();
|
||||
|
||||
let mut con = match redis.get_async_connection().await {
|
||||
Ok(con) => con,
|
||||
Err(e) => {
|
||||
eprintln!("Failed to get async connection: {}", e);
|
||||
for chat_id in &chats {
|
||||
if let Err(e) = pubsub.subscribe(format!("chat:{}", chat_id)).await {
|
||||
eprintln!("Failed to subscribe to chat: {}", e);
|
||||
return HttpResponse::InternalServerError().finish();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
let _ = match con.srem::<&str, &i32, usize>("authors-online", &author_id).await {
|
||||
Ok(_) => (),
|
||||
|
|
Loading…
Reference in New Issue
Block a user