0

I'm trying to stop a node js app from continuing to execute new code. I thought about using an infinite timeout, but that seems cludgy. Is there a halt execution of sorts without exiting the application?

I'm currently just using setTimeout to some long time, and the application starts.

I'm currently using pm2 to keep the application running, in case there's an error. But if I have my config files set to "disable", I'd like the application to stay "active" but not doing anything.

When the config is updated, a pm2 restart is completed, and it's restarted and if the program is set to be enabled, it will continue execution, if it's set to disabled, it should sit there and do nothing.

I keep pm2 running the application, as it lets me know that the application is functional, and not restarting unless I tell it to.

Ideas?

Clown Man
  • 385
  • 1
  • 3
  • 12
  • Possible duplicate of [How to create a sleep/delay in nodejs that is Blocking?](https://stackoverflow.com/questions/20967006/how-to-create-a-sleep-delay-in-nodejs-that-is-blocking) – Sterling Archer May 13 '19 at 14:00
  • I'm already doing that with a setTimeout `const TIMEOUT_MAX = 2 ** 31 - 1;`. I know it's not best practice, but it seems like the best way to achieve what I'm looking for. – Clown Man May 13 '19 at 15:11

0 Answers0