Skip to content

Commit

Permalink
Merge PR #18 and #17 (#19)
Browse files Browse the repository at this point in the history
* fixes cache key naming (#18)

* replace queueUrl to queue (#17)
  • Loading branch information
nicholasnet authored Aug 31, 2017
1 parent e4c6bce commit 8a5165f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Command/RestartCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
if ($this->cache !== null) {

$this->cache->set('ideasbucket_queue:restart', time());
$this->cache->set('ideasbucket_queue_restart', time());
$output->writeln('Broadcasting queue restart signal.');

} else {
Expand Down
15 changes: 5 additions & 10 deletions src/Job/SqsJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,20 @@ class SqsJob extends AbstractJob implements JobsInterface
*/
protected $jobData;

/**
* @var string
*/
protected $queueUrl;

/**
* Create a new job instance.
*
* @param ContainerInterface $container
* @param \Aws\Sqs\SqsClient $sqs
* @param array $jobData
* @param string $connectionName
* @param string $queueUrl
* @param string $queue
*/
public function __construct(ContainerInterface $container, SqsClient $sqs, array $jobData, $connectionName, $queueUrl)
public function __construct(ContainerInterface $container, SqsClient $sqs, array $jobData, $connectionName, $queue)
{
$this->sqs = $sqs;
$this->jobData = $jobData;
$this->queueUrl = $queueUrl;
$this->queue = $queue;
$this->container = $container;
$this->connectionName = $connectionName;
}
Expand All @@ -59,7 +54,7 @@ public function release($delay = 0)
parent::release($delay);

$this->sqs->changeMessageVisibility([
'QueueUrl' => $this->queueUrl,
'QueueUrl' => $this->queue,
'ReceiptHandle' => $this->jobData['ReceiptHandle'],
'VisibilityTimeout' => $delay,
]);
Expand All @@ -72,7 +67,7 @@ public function delete()
{
parent::delete();

$this->sqs->deleteMessage(['QueueUrl' => $this->queueUrl, 'ReceiptHandle' => $this->jobData['ReceiptHandle']]);
$this->sqs->deleteMessage(['QueueUrl' => $this->queue, 'ReceiptHandle' => $this->jobData['ReceiptHandle']]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ protected function getTimestampOfLastQueueRestart()
{
if ($this->cache) {

return $this->cache->get('ideasbucket_queue:restart');
return $this->cache->get('ideasbucket_queue_restart');
}
}

Expand Down

0 comments on commit 8a5165f

Please sign in to comment.