Graceful shutdown on SIGTERM?

Ahh, so I should have my stage trap exits, and then have my supervisor start them with shutdown: 25_000, to accomplish the goal of “consumer stages have 25 seconds to finish handling the current event before being brutally killed and program stops”?

That is way easier than what I was trying to do, I’m super glad I asked… :+1:

Also, how do I initiate shutdown from within the application? Is it :init.stop()? Use case is that I have a heartbeat process that pings the server I’m fetching events from. The server can respond to a ping with a “shutdown now please” message.

Thanks a ton!

2 Likes