Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix: Properly close command client WebSocket when disabling remotely

rcourtman9a9c50f8b15d
diff --git a/internal/hostagent/agent.go b/internal/hostagent/agent.go
index 8f63e95619..603ed165f5 100644
--- a/internal/hostagent/agent.go
+++ b/internal/hostagent/agent.go
@@ -462,7 +462,10 @@ func (a *Agent) applyRemoteConfig(commandsEnabled bool) {
} else if !commandsEnabled && currentlyEnabled {
// Server disabled commands, but we have a command client running
a.logger.Info().Msg("Server disabled command execution - stopping command client")
- // Signal stop (the command client will exit on next iteration)
+ // Properly close the WebSocket connection to stop the client
+ if err := a.commandClient.Close(); err != nil {
+ a.logger.Debug().Err(err).Msg("Error closing command client connection")
+ }
a.commandClient = nil
}
}