Ladder99 / ladder99

Ladder99 - connects factory devices to database and visualizations using MTConnect, an open standard.
https://mriiot.com
Apache License 2.0
27 stars 10 forks source link

Handle `SIGINT` and other signals to shutdown all running apps gracefully #208

Open MRIIOT opened 1 year ago

MRIIOT commented 1 year ago

What is the behavior now?

bburns commented 1 year ago

on 'docker stop', a SIGINT signal is sent - if the container doesn't respond to it within 10 seconds, it kills the container.

so we need adapter to catch the SIGINT signals and tell all the running drivers to shutdown / unsubscribe / disconnect.

not crucial but nice to have.

tukusejssirs commented 1 year ago

@bburns, IMHO we should implement this in each app, not only adapter.

Also, you added etc to the issue title; what other signals should we handle? IMO SIGINT is enough.

Also note that this can be easily handled using Nest. We could even have an API endpoint to shutdown the app. The (micro-) services could communicate using TCP (or any other so-called transport) though, not necessarily using REST/GQL API (actually, REST/GQL API should be available only in the gateway app IMHO which would manage all the other apps/microservices).