Skip to content

Commit ec7216e

Browse files
linting
1 parent b4643da commit ec7216e

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

src/Commands/Workflow/WaitCommand.php

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ public function workflowWait(
7070
if (!$startTime) {
7171
$startTime = time() - 60;
7272
}
73-
73+
7474
if (!empty($options['commit'])) {
7575
$this->waitForCommit($startTime, $site, $env_name, $options['commit'], $options['max']);
7676
return;
7777
}
78-
78+
7979
$this->waitForWorkflow($startTime, $site, $env_name, $description, $options['max']);
8080
}
8181

@@ -208,15 +208,15 @@ protected function waitForCommit(
208208
'commit' => $target_commit,
209209
'env' => $env_name
210210
]);
211-
211+
212212

213213
$workflow = null;
214214
$retry_count = 0;
215215
$max_retries = 10;
216216

217217
do {
218218
$current_time = time();
219-
219+
220220
// Check timeout
221221
if ($end_time > 0 && $current_time >= $end_time) {
222222
throw new TerminusException(
@@ -233,12 +233,15 @@ protected function waitForCommit(
233233

234234
// Filter for the target environment and commit
235235
$matching_workflows = [];
236-
236+
237237
foreach ($workflow_logs as $log) {
238238
// Check if this workflow is for the target environment
239239
if (isset($log->workflow->environment) && $log->workflow->environment === $env_name) {
240240
// Check if this workflow has the target commit (support shortened hashes)
241-
if (isset($log->workflow->target_commit) && strpos($log->workflow->target_commit, $target_commit) === 0) {
241+
if (
242+
isset($log->workflow->target_commit) &&
243+
strpos($log->workflow->target_commit, $target_commit) === 0
244+
) {
242245
// Check if workflow started after our start time
243246
if (isset($log->workflow->started_at) && $log->workflow->started_at >= $startTime) {
244247
$matching_workflows[] = $log;
@@ -256,10 +259,10 @@ protected function waitForCommit(
256259
// Find the most recent matching workflow
257260
if (!empty($matching_workflows)) {
258261
// Sort by started_at descending to get the most recent
259-
usort($matching_workflows, function($a, $b) {
262+
usort($matching_workflows, function ($a, $b) {
260263
return $b->workflow->started_at <=> $a->workflow->started_at;
261264
});
262-
265+
263266
$workflow = $matching_workflows[0];
264267
$this->log()->notice('Found workflow {id} with description "{description}" for commit {commit}', [
265268
'id' => $workflow->workflow->id,
@@ -282,7 +285,6 @@ protected function waitForCommit(
282285
'max' => $max_retries
283286
]);
284287
sleep(5);
285-
286288
} while (!$workflow);
287289

288290
// Now wait for the workflow to complete
@@ -316,23 +318,28 @@ protected function waitForCommit(
316318
}
317319

318320
if (!$updated_workflow) {
319-
throw new TerminusException('Workflow {id} disappeared during execution.', ['id' => $workflow->workflow->id]);
321+
throw new TerminusException(
322+
'Workflow {id} disappeared during execution.',
323+
['id' => $workflow->workflow->id]
324+
);
320325
}
321326

322327
$workflow = $updated_workflow;
323-
328+
324329
$this->log()->debug('Workflow {id} status: {status}', [
325330
'id' => $workflow->workflow->id,
326331
'status' => $workflow->workflow->status ?? 'unknown'
327332
]);
328333

329334
// Check if workflow is finished
330-
if (isset($workflow->workflow->status) && in_array($workflow->workflow->status, ['Success', 'Failed', 'Aborted'])) {
335+
if (
336+
isset($workflow->workflow->status) &&
337+
in_array($workflow->workflow->status, ['Success', 'Failed', 'Aborted'])
338+
) {
331339
break;
332340
}
333341

334342
usleep($retry_interval * 1000);
335-
336343
} while (true);
337344

338345
// Check if workflow succeeded

0 commit comments

Comments
 (0)