zenstruck / messenger-test

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

[fix] prevent infinite loop in unblock mode (#32) #36

Closed nikophil closed 2 years ago

nikophil commented 2 years ago

closes #32

A better solution was to send envelopes one by one from TestTransport::get() and directly remove them from self::$queue[$name] in the get() method. Somehow I think we're closer from the real mechanism since when a message is passed to the worker it's removed from the queue.

BTW if you remove the fix, the test process_x_recursive_when_intercept_disabled() creates an infinite loop. This behavior wasn't caught by the tests because other tests which uses unblock() do not dispatch messages "D" or "E" which are not only ones which are recursive.

kbond commented 2 years ago

Perfect, thanks @nikophil!