fix: silently ignore heartbeat_ack instead of logging 'Unknown command type' (v1.3.0)
The server replies to the agent's own heartbeat with heartbeat_ack; the agent had no case for it, so it fell through to the unknown-command handler, logged 'Unknown command type: heartbeat_ack' every minute, and answered with a spurious error response. heartbeats are fire-and-forget acks — nothing to run, nothing to reply.
This commit is contained in:
@@ -311,6 +311,13 @@ func handleCommand(cm *ConfigManager, msg WSMessage, c MessageWriter, exec Execu
|
||||
respPayload, _ := json.Marshal(resp)
|
||||
c.WriteMessage(websocket.TextMessage, respPayload)
|
||||
return
|
||||
// heartbeat_ack is the server's acknowledgement of the agent's own periodic
|
||||
// heartbeat (the agent sends `heartbeat`, the server answers `heartbeat_ack`).
|
||||
// There is nothing to do with it -- it is not a command to run, and answering
|
||||
// an ack with an error response would inject spurious errors into the
|
||||
// command-response channel every minute. Silently ignore.
|
||||
case "heartbeat_ack":
|
||||
return
|
||||
default:
|
||||
log.Printf("Unknown command type: %s", msg.Type)
|
||||
sendResponse("error", "unknown command type")
|
||||
|
||||
Reference in New Issue
Block a user