platformatic / rabbitmq-hooks

RabbitMQ adapter for Platformatic
Apache License 2.0
4 stars 0 forks source link

Provide a better error if we could not connect to RabbitMQ #41

Closed mcollina closed 3 months ago

mcollina commented 3 months ago

if https://github.com/platformatic/rabbitmq-hooks/blob/4aaafe6229f37d4aff44ad5faee785e57e08b80c/lib/plugin.js#L30 times out, it errors with stackable could not start in time. I think we can provide a better error message.

marcopiraccini commented 3 months ago

@mcollina I am not sure about this. what actually times out is Fastify that waits when loading plugins. If the connection to rabbitmq throws (here) the plugin is not started, right?

But if the listen is slow (here: https://github.com/platformatic/rabbitmq-hooks/blob/4aaafe6229f37d4aff44ad5faee785e57e08b80c/lib/rabbitmq.js#L83C101-L83C109) It might be because the assertQueue / bindQueue , etc are slow? In this case shouldn't we just increment the Fastify timeout in loading plugins? (BTW I couldn't reproduce the issue).

mcollina commented 3 months ago

This is actually fixed in avvio, we now provide a better error in this case.

https://github.com/fastify/avvio/releases/tag/v8.3.2