openrm / hato

A minimalist, customizeable AMQP framework in Node.js
MIT License
1 stars 0 forks source link

Release the retry if sigint/sigterm received #41

Closed PuKoren closed 4 years ago

PuKoren commented 4 years ago

@openrm/dev

Previously the retry plugin was not releasing the backoff logic when a SIGINT/SIGTERM was received during the initial connection

naggingant commented 4 years ago

@PuKoren re-posting a corrected comment:

The plugin already has destroy() hook implemented for the same reason, and it was expected to be triggered when the client is closed. But I think this was a unhandled case therefore the solution is to properly ensure that destroy() is called in the case.

I pushed a change in attempt to achieve this here: https://github.com/openrm/hato/compare/fix/destroy-hook Could you try it out to see if it fixes the issue?

PuKoren commented 4 years ago

@naggingant unfortunately it does not fix the issue for me the promise chain is locked at the channel close until the retry plugin releases

naggingant commented 4 years ago

Okay, got it. Could you explain how to reproduce it? I would like to try to find a way myself.

Even if this was the only way, we should make the driver call destroy() I think :thinking:

PuKoren commented 4 years ago

To reproduce it you can start a service without rabbitmq running, so it will trigger the retry logic Then if you try to interrupt the program, you will have to wait until the retry plugin gives up to see the service shutting down

its minor issue, as in the worst case user will have to wait the specified timeout to have the node program gracefully shutdown

about close() I think so too, there is a probably a way to do it without the signal listeners

I think we can take our time on this one as its not a big issue

PuKoren commented 4 years ago

I'll let you merge it when you want as you are leading on hato :bow:

naggingant commented 4 years ago

Got it, thanks a lot for working on this!