You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/web/app/Command/CloudLifecycle.php

29 lines
714 B
PHP

<?php
namespace App\Command;
use App\Services\Cloud\CloudLifecycleService;
final class CloudLifecycle
{
public static function run(array $argv = []): int
{
$once = in_array('--once', $argv, true);
$service = new CloudLifecycleService();
do {
try {
$service->tick();
} catch (\Throwable $error) {
fwrite(STDERR, 'cloud lifecycle temporarily unavailable: '
. get_class($error) . PHP_EOL);
if ($once) {
return 1;
}
}
if (!$once) {
usleep(15000000);
}
} while (!$once);
return 0;
}
}