Skip to content

Commit

Permalink
Update tests-pecl-ext/StorageRedisDsnModuleTest.php
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
koriym and coderabbitai[bot] authored Nov 1, 2024
1 parent df7d1cd commit d67eeb7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests-pecl-ext/StorageRedisDsnModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,16 @@ public static function setUpBeforeClass(): void
self::$process = new Process(['redis-server']);
self::$process->disableOutput();
self::$process->start();
usleep(1000000); //wait for server to get going
$maxAttempts = 10;
$attempt = 0;
while ($attempt < $maxAttempts) {
if (@fsockopen('localhost', 6379)) {
return;
}
usleep(100000); // 100ms
$attempt++;
}
throw new \RuntimeException('Redis server failed to start');
}

public static function tearDownAfterClass(): void
Expand Down

0 comments on commit d67eeb7

Please sign in to comment.