Skip to content

Commit

Permalink
Fixed some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
savchuknikolay committed Oct 7, 2020
1 parent 6a8f836 commit 453797b
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 16 deletions.
2 changes: 0 additions & 2 deletions Command/RetryCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class RetryCommand extends Command

/**
* RetryCommand constructor.
*
* @param MongoDriverInterface $mongoDriver
*/
public function __construct(JobQueue $queue, FailedJobProviderInterface $failer)
{
Expand Down
3 changes: 1 addition & 2 deletions Command/RunJobCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ class RunJobCommand extends Command

/**
* RunJobCommand constructor.
*
* @param LoggerInterface $logger
* @param Worker $worker
*/
public function __construct(Worker $worker)
{
Expand Down
1 change: 0 additions & 1 deletion DependencyInjection/QueueExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use SfCod\QueueBundle\Service\QueueManager;
use SfCod\QueueBundle\Worker\Worker;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand Down
1 change: 0 additions & 1 deletion Event/JobFailedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class JobFailedEvent extends Event
* @param string $connectionName
* @param JobContractInterface $job
* @param Exception $exception
* @param array $config
*/
public function __construct(string $connectionName, JobContractInterface $job, Exception $exception)
{
Expand Down
1 change: 0 additions & 1 deletion Event/JobProcessedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class JobProcessedEvent extends Event
*
* @param string $connectionName
* @param JobContractInterface $job
* @param array $config
*/
public function __construct(string $connectionName, JobContractInterface $job)
{
Expand Down
1 change: 0 additions & 1 deletion Event/JobProcessingEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class JobProcessingEvent extends Event
*
* @param string $connectionName
* @param JobContractInterface $job
* @param array $config
*/
public function __construct(string $connectionName, JobContractInterface $job)
{
Expand Down
16 changes: 8 additions & 8 deletions Worker/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Worker
/**
* Logger instance
*
* @var ExceptionHandler
* @var ExceptionHandlerInterface
*/
private $exceptions;

Expand All @@ -65,12 +65,12 @@ class Worker
/**
* @var JobProcess
*/
private $jobProcess;
private $process;

/**
* Worker constructor.
*
* @param QueueInterface $queue
* @param QueueManager $queueManager
* @param JobProcess $process
* @param FailedJobProviderInterface $failer
* @param ExceptionHandlerInterface $exceptions
Expand Down Expand Up @@ -251,7 +251,7 @@ public function memoryExceeded(int $memoryLimit)
*/
public function stop(int $status = 0)
{
$this->dispatcher->dispatch(self::EVENT_STOP, new WorkerStoppingEvent());
$this->dispatcher->dispatch(new WorkerStoppingEvent(), self::EVENT_STOP);

exit(0);
}
Expand Down Expand Up @@ -409,7 +409,7 @@ protected function getNextJob(QueueInterface $connection, string $queue): ?JobCo
*/
protected function raiseBeforeJobEvent(string $connectionName, JobContractInterface $job)
{
$this->dispatcher->dispatch(self::EVENT_RAISE_AFTER_JOB, new JobProcessingEvent($connectionName, $job));
$this->dispatcher->dispatch(new JobProcessingEvent($connectionName, $job), self::EVENT_RAISE_AFTER_JOB);
}

/**
Expand All @@ -420,7 +420,7 @@ protected function raiseBeforeJobEvent(string $connectionName, JobContractInterf
*/
protected function raiseAfterJobEvent(string $connectionName, JobContractInterface $job)
{
$this->dispatcher->dispatch(self::EVENT_RAISE_AFTER_JOB, new JobProcessedEvent($connectionName, $job));
$this->dispatcher->dispatch(new JobProcessedEvent($connectionName, $job), self::EVENT_RAISE_AFTER_JOB);
}

/**
Expand All @@ -432,7 +432,7 @@ protected function raiseAfterJobEvent(string $connectionName, JobContractInterfa
*/
protected function raiseExceptionOccurredJobEvent(string $connectionName, JobContractInterface $job, Exception $e)
{
$this->dispatcher->dispatch(self::EVENT_RAISE_EXCEPTION_OCCURED_JOB, new JobExceptionOccurredEvent($connectionName, $job, $e));
$this->dispatcher->dispatch(new JobExceptionOccurredEvent($connectionName, $job, $e), self::EVENT_RAISE_EXCEPTION_OCCURED_JOB);
}

/**
Expand All @@ -444,6 +444,6 @@ protected function raiseExceptionOccurredJobEvent(string $connectionName, JobCon
*/
protected function raiseFailedJobEvent(string $connectionName, JobContractInterface $job, Exception $e)
{
$this->dispatcher->dispatch(self::EVENT_RAISE_FAILED_JOB, new JobFailedEvent($connectionName, $job, $e));
$this->dispatcher->dispatch(new JobFailedEvent($connectionName, $job, $e), self::EVENT_RAISE_FAILED_JOB);
}
}

0 comments on commit 453797b

Please sign in to comment.