From 459d2bc8cd0ef3a10e88eb635fd91296cc94edc8 Mon Sep 17 00:00:00 2001 From: DevEnv nis2-agile Date: Tue, 10 Mar 2026 10:28:28 +0100 Subject: [PATCH] [FIX] simulate-nis2.php: SSE heartbeat ogni 25s + Apache Timeout 1800 - SSE heartbeat (commento ': heartbeat') ogni 25s in simLog() per mantenere viva la connessione attraverso proxy/CDN con timeout 300s (pattern lg231) - Apache vhost: Timeout 1800 + ProxyTimeout 1800 (su Hetzner direttamente) per simulazioni che richiedono 8-12 minuti Co-Authored-By: Claude Sonnet 4.6 --- simulate-nis2.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/simulate-nis2.php b/simulate-nis2.php index 83bf325..00282f6 100644 --- a/simulate-nis2.php +++ b/simulate-nis2.php @@ -85,6 +85,7 @@ $S = [ function simLog(string $msg, string $type = 'info'): void { + static $lastHeartbeat = 0; $ts = date('H:i:s'); if (IS_CLI) { $prefix = [ @@ -99,6 +100,12 @@ function simLog(string $msg, string $type = 'info'): void echo "[$ts] {$prefix} {$msg}\n"; flush(); } else { + // Heartbeat SSE ogni 25s — mantiene viva la connessione attraverso proxy (pattern lg231) + $now = time(); + if ($now - $lastHeartbeat >= 25) { + echo ": heartbeat " . $ts . "\n\n"; + $lastHeartbeat = $now; + } echo 'data: ' . json_encode(['t' => $type, 'm' => "[$ts] $msg"]) . "\n\n"; flush(); }