Skip to content

Commit 8862a9d

Browse files
committed
Merge remote-tracking branch 'origin/v3' into v3
2 parents fd77a20 + 6d3fcda commit 8862a9d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Ephemeral/EphemeralHypernodeManager.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public function waitForAvailability(string $ephemeralHypernode, int $timeout = 9
5151
$latest = microtime(true);
5252
$timeElapsed = 0;
5353
$resolved = false;
54+
$interval = 3;
55+
$allowedErrorWindow = 3;
5456

5557
while ($timeElapsed < $timeout && !$resolved) {
5658
$now = microtime(true);
@@ -76,10 +78,19 @@ public function waitForAvailability(string $ephemeralHypernode, int $timeout = 9
7678
// Otherwise, there's an error, and it should be propagated.
7779
if ($e->getCode() !== 404) {
7880
throw $e;
81+
} elseif ($timeElapsed < $allowedErrorWindow) {
82+
// Sometimes we get an error where the logbook is not yet available, but it will be soon.
83+
// We allow a small window for this to happen, and then we throw an exception.
84+
sprintf(
85+
'Got an expected exception during the allowed error window of HTTP code %d, waiting for %s to become available',
86+
$e->getCode(),
87+
$ephemeralHypernode
88+
);
89+
continue;
7990
}
8091
}
8192

82-
sleep(5);
93+
sleep($interval);
8394
}
8495

8596
if (!$resolved) {

0 commit comments

Comments
 (0)