swicthed back to network mod and added helatcheck for diagnostic to restart
This commit is contained in:
@@ -82,6 +82,27 @@ function pipelineEnd(ok, detail) {
|
||||
pipelineActive = false;
|
||||
}
|
||||
|
||||
// ── Auto-Restart bei Netzwerk-Namespace-Verlust ──────
|
||||
// Bei network_mode: "service:aria" verliert dieser Container
|
||||
// den Netzwerkzugriff wenn aria-core neustartet.
|
||||
// Nach MAX_GATEWAY_FAILURES aufeinanderfolgenden Fehlern → process.exit
|
||||
// Docker restart: unless-stopped startet uns mit neuem Namespace neu.
|
||||
const MAX_GATEWAY_FAILURES = 6; // 6 × 5s = 30s
|
||||
let gatewayFailCount = 0;
|
||||
|
||||
function checkGatewayHealth() {
|
||||
if (state.gateway.status === "connected") {
|
||||
gatewayFailCount = 0;
|
||||
return;
|
||||
}
|
||||
gatewayFailCount++;
|
||||
if (gatewayFailCount >= MAX_GATEWAY_FAILURES) {
|
||||
log("error", "server", `Gateway ${MAX_GATEWAY_FAILURES}x nicht erreichbar — Neustart (Netzwerk-Namespace veraltet?)`);
|
||||
// Kurze Verzoegerung damit die Log-Nachricht noch gesendet wird
|
||||
setTimeout(() => process.exit(1), 500);
|
||||
}
|
||||
}
|
||||
|
||||
function nextReqId() {
|
||||
return `diag-${++reqIdCounter}`;
|
||||
}
|
||||
@@ -191,6 +212,7 @@ async function connectGateway() {
|
||||
state.gateway.status = "connected";
|
||||
state.gateway.handshakeOk = true;
|
||||
state.gateway.lastError = null;
|
||||
gatewayFailCount = 0;
|
||||
} else {
|
||||
const error = typeof response.error === "string"
|
||||
? response.error
|
||||
@@ -219,6 +241,7 @@ async function connectGateway() {
|
||||
state.gateway.handshakeOk = false;
|
||||
gatewayWs = null;
|
||||
broadcastState();
|
||||
checkGatewayHealth();
|
||||
// Auto-Reconnect nach 5s
|
||||
setTimeout(connectGateway, 5000);
|
||||
});
|
||||
@@ -236,6 +259,7 @@ async function connectGateway() {
|
||||
state.gateway.handshakeOk = false;
|
||||
gatewayWs = null;
|
||||
broadcastState();
|
||||
checkGatewayHealth();
|
||||
// Retry nach 5s
|
||||
setTimeout(connectGateway, 5000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user