From b31054ab0c2c21b24cd0eb3063b8deb2eaba3e3b Mon Sep 17 00:00:00 2001 From: Marcel Bolten Date: Wed, 8 Nov 2023 10:40:17 -0800 Subject: [PATCH 1/2] avoid infinite loop --- c3.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/c3.php b/c3.php index 1a42ef7..efda189 100644 --- a/c3.php +++ b/c3.php @@ -265,7 +265,8 @@ function __c3_factory($filename, $lock = false) // wait until serialized coverage data of all tests is written to file $blockfilename = realpath(C3_CODECOVERAGE_MEDIATE_STORAGE) . DIRECTORY_SEPARATOR . 'block_report'; if (file_exists($blockfilename) && filesize($blockfilename) !== 0) { - while(file_get_contents($blockfilename) !== '0') { + $retries = 10; + while (file_get_contents($blockfilename) !== '0' && --$retries >= 0) { usleep(250000); // 0.25 sec } } From 580cbd21e2ae6be803e5652594433b6e37d2cb65 Mon Sep 17 00:00:00 2001 From: Marcel Bolten Date: Tue, 28 Nov 2023 20:18:15 -0800 Subject: [PATCH 2/2] 30 sec maximum wait time for all tests to finish upon report request --- c3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c3.php b/c3.php index efda189..eedc73d 100644 --- a/c3.php +++ b/c3.php @@ -265,7 +265,7 @@ function __c3_factory($filename, $lock = false) // wait until serialized coverage data of all tests is written to file $blockfilename = realpath(C3_CODECOVERAGE_MEDIATE_STORAGE) . DIRECTORY_SEPARATOR . 'block_report'; if (file_exists($blockfilename) && filesize($blockfilename) !== 0) { - $retries = 10; + $retries = 120; // 30 sec total while (file_get_contents($blockfilename) !== '0' && --$retries >= 0) { usleep(250000); // 0.25 sec }