zenstruck / messenger-test

Assertions and helpers for testing your symfony/messenger queues.
MIT License
226 stars 15 forks source link

Infinite loop when a transport dispatches message in itself #32

Closed nikophil closed 2 years ago

nikophil commented 2 years ago

Hi there!

I think I've found a bug: in unblock mode if a transport posts in itself, an infinite loop occurs.

This is because TestTransport::get() does not empty the queue when dispatching envelopes to the worker. Maybe TestTransport::$queue should be put in another temporary array after being sent to worker.

Here is a reproducer. https://github.com/nikophil/zenstruck_messenger_test_bug_reproducer

Thanks for your work!