Redningsselskapet / nestjs-plugins

Plugins for NestJS framework
ISC License
27 stars 22 forks source link

NatsError: CONNECTION_DRAINING at application shutdown #43

Closed is-blackhole closed 1 year ago

is-blackhole commented 1 year ago

Hello :)

I got uncatchable NatsError: CONNECTION_DRAINING exception when shutting down app with app.close() I need it at my tests to cleanup.

To Reproduce Steps to reproduce the behavior: Add to packages/nats-listener/src/main.ts at bootstrap end after await microService.listen();:

  setTimeout(async() => {
    logger.log("closing app");
    try {
      await app.close();
    } catch (err) {
      logger.error(err);
    }
    logger.log("closed");
  }, 10*1000);

Expected behavior App closes, logging "closed";

Screenshots image

Looks like app tries to delete consumer via $JS.API.CONSUMER.DELETE .... after drain is called, can you plz take a look?

Thanks

kenguru33 commented 1 year ago

fixed