Skip to content

Commit

Permalink
Merge pull request #91 from MarcelBolten/max-retries
Browse files Browse the repository at this point in the history
Avoid infinite loop while waiting for all running tests to finish
  • Loading branch information
Naktibalda committed Dec 1, 2023
2 parents e23298a + 580cbd2 commit d578d44
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion c3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 120; // 30 sec total
while (file_get_contents($blockfilename) !== '0' && --$retries >= 0) {
usleep(250000); // 0.25 sec
}
}
Expand Down

0 comments on commit d578d44

Please sign in to comment.