Skip to content

Commit

Permalink
Reorder sleep and time check
Browse files Browse the repository at this point in the history
  • Loading branch information
AJGranowski committed Jan 13, 2025
1 parent 18abc38 commit 71afbfd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/Singletons/AssetsManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ class AssetsManifest
public function __construct()
{
$manifestPath = public_path('assets/manifest.json');

$startTimeSeconds = microtime(true);
$elapsedTimeSeconds = 0;

while (!file_exists($manifestPath)) {
sleep(self::MANIFEST_TIMEOUT_INTERVAL_SECONDS);
$elapsedTimeSeconds = microtime(true) - $startTimeSeconds;
if ($elapsedTimeSeconds >= self::MANIFEST_TIMEOUT_SECONDS) {
throw new Exception('The manifest does not exist.');
}

sleep(self::MANIFEST_TIMEOUT_INTERVAL_SECONDS);
}

$this->manifest = json_decode(file_get_contents($manifestPath), true);
Expand Down

0 comments on commit 71afbfd

Please sign in to comment.