Search code examples
node.jsexpressheroku

make nodejs heroku app do something before become idle


I have nodejs web hosted in heroku. I want to make my app.js do something before going to idle. Like I have a function called prepareIdle(), and i want my app.js called that before going idle. Thanks in advance


Solution

  • Try listening to the signal SIGTERM and do what ever you want within 30 seconds. After 30 seconds, you will receive a SIGKILL signal