cote icon indicating copy to clipboard operation
cote copied to clipboard

Add graceful shutdown for requesters and responders

Open otothea opened this issue 2 years ago • 1 comments

Adds support for callback when calling .close() on a component to allow graceful shutdown.

If a callback is passed then the component will:

  • immediately close discovery
  • Wait for message queue to drain before calling callback

example use case:

const Responder = require('cote').Responder;

...

process.once('SIGINT', () => {
    randomResponder.close(() => {
        process.exit();
    });
});

otothea avatar Feb 05 '23 20:02 otothea

Hate to be that guy, but, what is stopping this from being merged?

daniandl avatar Aug 31 '23 10:08 daniandl