From 2fcef7e4186ab677c0da2468f83f66f5656d3430 Mon Sep 17 00:00:00 2001 From: TSURU Date: Wed, 12 Mar 2025 13:27:02 +0900 Subject: [PATCH 1/2] feat: Allow configurable timeout via environment variable - The timeout value (in microseconds) is now configurable using the `BREF_FPM_READY_TIMEOUT` environment variable. - If the `BREF_FPM_READY_TIMEOUT` variable is not set, the default timeout is 5 seconds (5000000 microseconds). --- src/FpmRuntime/FpmHandler.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/FpmRuntime/FpmHandler.php b/src/FpmRuntime/FpmHandler.php index caa1ef145..d231179d3 100644 --- a/src/FpmRuntime/FpmHandler.php +++ b/src/FpmRuntime/FpmHandler.php @@ -198,6 +198,7 @@ private function ensureStillRunning(): void /** * @throws Exception + * @see https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtime-environment.html#runtimes-lifecycle-ib */ private function waitUntilReady(): void { @@ -205,6 +206,10 @@ private function waitUntilReady(): void $timeout = 5000000; // 5 secs $elapsed = 0; + if ($_SERVER['BREF_FPM_READY_TIMEOUT'] ?? false) { + $timeout = (int) $_SERVER['BREF_FPM_READY_TIMEOUT']; + } + while (! $this->isReady()) { usleep($wait); $elapsed += $wait; From 56a9ba635c9dd848d26bd1369e0c2b9dc3dd0f5f Mon Sep 17 00:00:00 2001 From: TSURU Date: Thu, 13 Mar 2025 12:22:45 +0900 Subject: [PATCH 2/2] fix: @see comment position --- src/FpmRuntime/FpmHandler.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/FpmRuntime/FpmHandler.php b/src/FpmRuntime/FpmHandler.php index d231179d3..3e80e2d36 100644 --- a/src/FpmRuntime/FpmHandler.php +++ b/src/FpmRuntime/FpmHandler.php @@ -197,8 +197,9 @@ private function ensureStillRunning(): void } /** - * @throws Exception * @see https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtime-environment.html#runtimes-lifecycle-ib + * + * @throws Exception */ private function waitUntilReady(): void {