Skip to content

Commit

Permalink
Merge pull request #67 from talis/namespace-spec-defined-queues
Browse files Browse the repository at this point in the history
90%: All queues (manually sent or defined in specs) should be namespaced
  • Loading branch information
rsinger committed Jun 24, 2015
2 parents 609a4a2 + ecea07e commit 3ee0a04
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/mongo/jobs/ApplyOperation.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public function createJob(Array $subjects, $queueName=null)
{
$queueName = \Tripod\Mongo\Config::getApplyQueueName();
}
elseif(strpos($queueName, \Tripod\Mongo\Config::getApplyQueueName()) === false)
{
$queueName = \Tripod\Mongo\Config::getApplyQueueName() . '::' . $queueName;
}

$data = array(
self::SUBJECTS_KEY=>array_map(function(\Tripod\Mongo\ImpactedSubject $subject) { return $subject->toArray(); }, $subjects),
Expand Down
4 changes: 4 additions & 0 deletions src/mongo/jobs/DiscoverImpactedSubjects.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ public function createJob(Array $data, $queueName=null)
{
$queueName = Config::getDiscoverQueueName();
}
elseif(strpos($queueName, \Tripod\Mongo\Config::getDiscoverQueueName()) === false)
{
$queueName = \Tripod\Mongo\Config::getDiscoverQueueName() . '::' . $queueName;
}
$this->submitJob($queueName,get_class($this),$data);
}

Expand Down
2 changes: 1 addition & 1 deletion test/unit/mongo/ApplyOperationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public function testCreateJobSpecifyQueue()
->setMockClassName('MockApplyOperation')
->getMock();

$queueName = 'TRIPOD_TESTING_QUEUE_' . uniqid();
$queueName = \Tripod\Mongo\Config::getApplyQueueName() . '::TRIPOD_TESTING_QUEUE_' . uniqid();

$applyOperation->expects($this->once())
->method('submitJob')
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mongo/DiscoverImpactedSubjectsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public function testCreateJobSpecifyQueue()
'contextAlias'=>'http://talisaspire.com/'
);

$queueName = 'TRIPOD_TESTING_QUEUE_' . uniqid();
$queueName = \Tripod\Mongo\Config::getDiscoverQueueName() . '::TRIPOD_TESTING_QUEUE_' . uniqid();

/** @var \Tripod\Mongo\Jobs\DiscoverImpactedSubjects|PHPUnit_Framework_MockObject_MockObject $discoverImpactedSubjects */
$discoverImpactedSubjects = $this->getMockBuilder('\Tripod\Mongo\Jobs\DiscoverImpactedSubjects')
Expand Down

0 comments on commit 3ee0a04

Please sign in to comment.