Skip to content
This repository was archived by the owner on Apr 11, 2022. It is now read-only.

Add prefix for all commands #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use Resque\Resque;
use Predis\Client;

$resque = new Resque(new Client());
$resque->enqueue('default_queue', 'App\Job', array('foo' => 'bar'), true);
$resque->enqueue('default_queue', \App\Job::class, array('foo' => 'bar'), true);
```

In order the arguments are: queue, job class, job payload, whether to enable tracking.
Expand Down
5 changes: 4 additions & 1 deletion src/Console/EnqueueCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected function configure()
parent::configure();

$this
->setName('enqueue')
->setName('queue:enqueue')
->setDescription('Enqueues a job into a queue')
->addArgument(
'queue',
Expand Down Expand Up @@ -49,6 +49,9 @@ protected function configure()
InputOption::VALUE_NONE,
'If present, the job will be tracked'
);

// Add old command name as alias
$this->setAliases(['enqueue']);
}

/**
Expand Down
5 changes: 4 additions & 1 deletion src/Console/WorkerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected function configure()
parent::configure();

$this
->setName('worker')
->setName('queue:worker')
->setDescription('Runs a Resque worker')
->addOption(
'queue',
Expand All @@ -32,6 +32,9 @@ protected function configure()
'Interval in seconds to wait for between reserving jobs',
5
);

// Add old command name as alias
$this->setAliases(['worker']);
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ protected function failJob($job, Exception $exception)
$queue
);

$this->logger->error($exception->getMessage());
$this->getResque()->getStatistic('failed')->incr();
$this->getStatistic('failed')->incr();
}
Expand Down