0

My Discord bot is hosted on Heroku. I'm trying to get the "SIGTERM" signal that heroku sends before restarting the dyno in my Discord bot so i can save some stuff to my database before the dyno gets terminated after 30seconds. How would i do that?

Luca
  • 68
  • 5
  • Why don't you just save to your database immediately? – stijndcl Jan 06 '23 at 17:45
  • @stijndcl because i save the collected chat exp locally and then bulk write it to the db collection every 30min. Its a Discord Server with 20k Members so the chat is active and saving the exp after every message wouldnt be that good ig. – Luca Jan 12 '23 at 16:21
  • And is there a reason that the solution in this question doesn't work? https://stackoverflow.com/questions/18499497/how-to-process-sigterm-signal-gracefully (using `signal` to attach a callback to that specific signal) – stijndcl Jan 12 '23 at 16:51

0 Answers0