优化 WebSocket 消息发送:移除不必要的 clone,注释掉 send_to_client
This commit is contained in:
parent
173814416f
commit
1ddb707a9b
|
|
@ -168,13 +168,14 @@ impl EventManager {
|
||||||
|
|
||||||
if let Some(ws_manager) = &ws_manager_clone {
|
if let Some(ws_manager) = &ws_manager_clone {
|
||||||
let ws_message = crate::websocket::WsMessage::PointNewValue(monitor);
|
let ws_message = crate::websocket::WsMessage::PointNewValue(monitor);
|
||||||
if let Err(e) = ws_manager.send_to_public(ws_message.clone()).await {
|
if let Err(e) = ws_manager.send_to_public(ws_message).await {
|
||||||
tracing::error!("Failed to send WebSocket message to public room: {}", e);
|
tracing::error!("Failed to send WebSocket message to public room: {}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = ws_manager.send_to_client(point_id, ws_message).await {
|
// 暂时注释掉 send_to_client,因为现在信息只需发送到 public
|
||||||
tracing::error!("Failed to send WebSocket message to client room {}: {}", point_id, e);
|
// if let Err(e) = ws_manager.send_to_client(point_id, ws_message).await {
|
||||||
}
|
// tracing::error!("Failed to send WebSocket message to client room {}: {}", point_id, e);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tracing::warn!("Point not found for source {} client_handle {}", source_id, client_handle);
|
tracing::warn!("Point not found for source {} client_handle {}", source_id, client_handle);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue