diff --git a/config/octane.php b/config/octane.php index 7fcf568..2b503f1 100644 --- a/config/octane.php +++ b/config/octane.php @@ -362,6 +362,6 @@ | */ - 'max_execution_time' => 30, + 'max_execution_time' => env('OCTANE_MAX_EXECUTION_TIME', 30), ]; diff --git a/src/Swoole/Handlers/OnServerStart.php b/src/Swoole/Handlers/OnServerStart.php index 179f158..bf00794 100644 --- a/src/Swoole/Handlers/OnServerStart.php +++ b/src/Swoole/Handlers/OnServerStart.php @@ -60,11 +60,18 @@ public function __invoke($server) } if ($this->maxExecutionTime > 0) { + // One line per boot so production can never silently run without + // request-timeout enforcement again - chasing the 210s stalls + // burned hours on exactly the question this answers. + error_log("⏱️ Timeout sweep armed: max_execution_time={$this->maxExecutionTime}s, interval={$this->timeoutSweepIntervalMs}ms"); + Timer::tick($this->timeoutSweepIntervalMs, function () use ($server) { (new EnsureRequestsDontExceedMaxExecutionTime( $this->extension, $this->timerTable, $this->maxExecutionTime, $server, $this->timeoutFallbackSignal ))(); }); + } else { + error_log('⚠️ Timeout sweep DISABLED: max_execution_time resolved to 0 - requests can run unbounded'); } } }