Skip to content

Commit

Permalink
Should no longer be possible to get into an infinite loop when auto-d…
Browse files Browse the repository at this point in the history
…eclaring exchanges and queues (#9)
  • Loading branch information
rgooding authored and TomK committed Sep 14, 2017
1 parent 776f6dc commit ab6f636
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Provider/Amqp/AmqpQueueProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function pushBatch(array $batch, $persistent = null)
$exchange,
$routingKey
) use (&$needRetry, &$needDeclare, &$autoDeclare) {
if($autoDeclare && ($replyCode == 312))
if($autoDeclare && (!$needDeclare) && ($replyCode == 312))
{
$needDeclare = true;
$needRetry = true;
Expand Down Expand Up @@ -170,7 +170,7 @@ public function pushBatch(array $batch, $persistent = null)
catch(\Exception $e)
{
$this->disconnectAll();
if($autoDeclare && ($e->getCode() == 404))
if($autoDeclare && (!$needDeclare) && ($e->getCode() == 404))
{
$needRetry = true;
$needDeclare = true;
Expand Down

0 comments on commit ab6f636

Please sign in to comment.