Skip to content

Commit

Permalink
[bug] disable retries
Browse files Browse the repository at this point in the history
This fixes a BC break introduced in #34. That PR fixed an issue where
the transport names were not being properly registered with the Worker.
This enabled the retry system but broke code that was not expecting
retries to be made.
  • Loading branch information
kbond committed Jan 7, 2022
1 parent 13376bb commit 1381f27
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/Transport/TestTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Symfony\Component\Messenger\Event\WorkerRunningEvent;
use Symfony\Component\Messenger\EventListener\StopWorkerOnMessageLimitListener;
use Symfony\Component\Messenger\MessageBusInterface;
use Symfony\Component\Messenger\Stamp\RedeliveryStamp;
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
use Symfony\Component\Messenger\Transport\TransportInterface;
use Symfony\Component\Messenger\Worker;
Expand Down Expand Up @@ -228,6 +229,11 @@ public function reject(Envelope $envelope): void

public function send(Envelope $envelope): Envelope
{
if ($envelope->last(RedeliveryStamp::class)) {
// message is being retried, don't process
return $envelope;
}

if ($this->shouldTestSerialization()) {
Assert::try(
fn() => $this->serializer->decode($this->serializer->encode($envelope)),
Expand Down
4 changes: 0 additions & 4 deletions tests/Fixture/config/multi_transport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ framework:
transports:
async1:
dsn: test://
retry_strategy:
max_retries: 0
async2:
dsn: test://?intercept=false&catch_exceptions=false&test_serialization=false
retry_strategy:
max_retries: 0
async3: in-memory://
routing:
Zenstruck\Messenger\Test\Tests\Fixture\Messenger\MessageA: [async1]
Expand Down
2 changes: 0 additions & 2 deletions tests/Fixture/config/single_transport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ framework:
transports:
async:
dsn: test://
retry_strategy:
max_retries: 0
routing:
Zenstruck\Messenger\Test\Tests\Fixture\Messenger\MessageA: [async]
Zenstruck\Messenger\Test\Tests\Fixture\Messenger\MessageB: [async]
Expand Down

0 comments on commit 1381f27

Please sign in to comment.