initial commit
This commit is contained in:
commit
3f64f4a49a
221 files changed
+26665
No files matched your search
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rsgrinko\Proton\Console\Commands;
|
||||
|
||||
use Rsgrinko\Proton\Console\Command;
|
||||
use Rsgrinko\Proton\Queue\Queue;
|
||||
use Rsgrinko\Proton\Queue\Worker;
|
||||
|
||||
/**
|
||||
* воркер очереди.
|
||||
*/
|
||||
final class WorkerCommand extends Command
|
||||
{
|
||||
public function name(): string
|
||||
{
|
||||
return 'worker';
|
||||
}
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return 'разбирать очередь задач и вести расписание';
|
||||
}
|
||||
|
||||
public function usage(): string
|
||||
{
|
||||
return 'worker [--once] [--queue=default]';
|
||||
}
|
||||
|
||||
public function run(): int
|
||||
{
|
||||
$queue = (string) $this->option('queue', Queue::DEFAULT_QUEUE);
|
||||
$result = (new Worker($queue))->run($this->hasOption('once'));
|
||||
|
||||
$this->line('Выполнено: ' . $result['done'] . ', с ошибкой: ' . $result['failed']);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user