Skip to content

Commit 4018708

Browse files
authored
Do not attempt to log in the model. (#2637)
1 parent 2e5af87 commit 4018708

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Models/Environment.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,8 +1019,10 @@ function ($domain) {
10191019
$domain = array_pop($domains);
10201020
$attempt = 0;
10211021
$success = false;
1022+
$lastError = null;
10221023

10231024
while ($attempt < $maxRetries && !$success) {
1025+
$lastError = null;
10241026
$attempt++;
10251027
try {
10261028
$response = $this->request()->request(
@@ -1036,10 +1038,7 @@ function ($domain) {
10361038
];
10371039
}
10381040
} catch (\Exception $e) {
1039-
$this->logger->debug(
1040-
"Failed to wake the site:\n{message}",
1041-
['message' => $e->getMessage(),]
1042-
);
1041+
$lastError = $e;
10431042
$success = false;
10441043
}
10451044

@@ -1048,6 +1047,12 @@ function ($domain) {
10481047
}
10491048
}
10501049

1050+
if ($lastError) {
1051+
throw new TerminusException(
1052+
'Failed to wake the site after ' . $maxRetries . ' attempts. Last error: ' . $lastError->getMessage()
1053+
);
1054+
}
1055+
10511056
throw new TerminusException('Failed to wake the site after ' . $maxRetries . ' attempts.');
10521057
}
10531058

0 commit comments

Comments
 (0)