Skip to content

Commit

Permalink
Do not attempt to log in the model.
Browse files Browse the repository at this point in the history
  • Loading branch information
kporras07 committed Oct 14, 2024
1 parent 2e5af87 commit 9736652
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Models/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -1019,8 +1019,10 @@ function ($domain) {
$domain = array_pop($domains);
$attempt = 0;
$success = false;
$lastError = null;

while ($attempt < $maxRetries && !$success) {
$lastError = null;
$attempt++;
try {
$response = $this->request()->request(
Expand All @@ -1036,10 +1038,7 @@ function ($domain) {
];
}
} catch (\Exception $e) {
$this->logger->debug(
"Failed to wake the site:\n{message}",
['message' => $e->getMessage(),]
);
$lastError = $e;
$success = false;
}

Expand All @@ -1048,6 +1047,12 @@ function ($domain) {
}
}

if ($lastError) {
throw new TerminusException(
'Failed to wake the site after ' . $maxRetries . ' attempts. Last error: ' . $lastError->getMessage()
);
}

throw new TerminusException('Failed to wake the site after ' . $maxRetries . ' attempts.');
}

Expand Down

0 comments on commit 9736652

Please sign in to comment.