twingly / twingly-amqp

:bus: Ruby gem for RabbitMQ subscribing and publishing
0 stars 0 forks source link

Make sure Subscriber tests wait for messages to be consumed #103

Closed roback closed 11 months ago

roback commented 11 months ago

We previously assumed "publisher confirms" in RabbitMQ would wait for the messages to be consumed by a subscriber, but as it turns out, it only waits for the messages to be put onto a queue (there are some more details on it in the documentation).

I added a sleep to the code, so that we give the subscriber time to handle any messages before we continue with the test. I found no better way to do this that to add a sleep. The tests for Bunny uses sleeps too, for example see this spec, so it seems like that's the best way.

I guess we could now remove the "publisher confirms" feature from twingly-amqp, as we don't really need it. We added it so we didn't have to sleep (in #50), but it turns out we do need the sleep after all. However, the "publisher confirms" ensures that the RabbitMQ server is ready, so it still does some good, so I think we can keep it around anyway.

close #102