Skip to content

Commit

Permalink
Improve messaging and other improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
kporras07 committed Sep 19, 2023
1 parent 170904d commit 28b5cfa
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/Commands/Env/WakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,27 @@ public function wake($site_env, $options = [
'delay' => 3,
])
{
$attempt = 0;
$attempt = 1;
$this->requireSiteIsNotFrozen($site_env);
$env = $this->getEnv($site_env);

while ($attempt < $options['retry']) {
while ($attempt <= $options['retry']) {
$wakeStatus = $env->wake();
if (empty($wakeStatus['success'])) {
$this->log()->notice('{target} is not awake, retrying in {delay} seconds', [
$this->log()->notice('{target} is not awake (attempt {attempt}/{max})...', [
'target' => $site_env,
'delay' => $options['delay'],
'attempt' => $attempt,
'max' => $options['retry'],
]);
sleep($options['delay']);
// If there is any attempt remaining, sleep for the delay period.
if ($attempt <= $options['retry'] - 1) {
$this->log()->notice('Sleeping for {delay} seconds...', ['delay' => $options['delay']]);
sleep($options['delay']);
}
$attempt++;
} else {
break;
continue;
}
break;
}

// @TODO: Move the exceptions up the chain to the `wake` function. (One env is ported over).
Expand Down

0 comments on commit 28b5cfa

Please sign in to comment.