fix: serialize ping state updates

This commit is contained in:
2026-04-19 22:48:41 +02:00
parent 11815fb807
commit b8f80932ed
3 changed files with 72 additions and 25 deletions

View File

@@ -381,14 +381,14 @@ struct MainView: View {
api = try await APIFactory.detectAndCreateAPI(baseURL: baseURL, apiKey: apiKey)
}
try await api.restartServer(apiKey: apiKey)
PingService.suppressChecks(for: server.hostname, duration: 90)
await PingService.suppressChecks(for: server.hostname, duration: 90)
return ServerActionFeedback(
title: "Reboot Requested",
message: "The reboot command was sent to \(server.hostname). The host may become unavailable briefly while it restarts."
)
} catch let error as URLError where Self.isExpectedRestartDisconnect(error) {
PingService.suppressChecks(for: server.hostname, duration: 90)
await PingService.suppressChecks(for: server.hostname, duration: 90)
return ServerActionFeedback(
title: "Reboot Requested",
message: "The reboot command appears to have been accepted by \(server.hostname). The connection dropped while the host was going away, which is expected during a reboot."