优化 WebSocket 消息发送:移除不必要的 clone,注释掉 send_to_client

This commit is contained in:
caoqianming 2026-03-04 12:35:22 +08:00
parent 173814416f
commit 1ddb707a9b
1 changed files with 5 additions and 4 deletions

View File

@ -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);