mirror of
https://github.com/shiroyashik/sculptor.git
synced 2025-12-06 04:51:13 +03:00
No more freezes?
This commit is contained in:
parent
34905701a0
commit
5eedf26ca8
1 changed files with 5 additions and 9 deletions
|
|
@ -146,7 +146,7 @@ async fn handle_socket(mut socket: WebSocket, state: AppState) {
|
|||
rx
|
||||
},
|
||||
};
|
||||
// .to_owned().subscribe();
|
||||
|
||||
let shutdown = Arc::new(Notify::new());
|
||||
tokio::spawn(subscribe(mtx.clone(), rx, shutdown.clone()));
|
||||
cutoff.insert(uuid, shutdown);
|
||||
|
|
@ -206,21 +206,17 @@ async fn subscribe(
|
|||
return;
|
||||
}
|
||||
msg = rx.recv() => {
|
||||
|
||||
let msg = msg.ok();
|
||||
|
||||
if let Some(msg) = msg {
|
||||
// debug!("[WebSocketSubscriber] Received: {msg}");
|
||||
if socket.send(msg.clone()).await.is_err() {
|
||||
error!("Forced shutdown SUB due error!");
|
||||
error!("Forced shutdown SUB! Reciever closed connection?");
|
||||
return;
|
||||
};
|
||||
} else {
|
||||
error!("Forced shutdown SUB! Sender closed connection?");
|
||||
return;
|
||||
}
|
||||
|
||||
// if socket.send(msg.unwrap()).await.is_err() {
|
||||
// error!("Forced shutdown SUB due error!");
|
||||
// return;
|
||||
// };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue