1

I'm using node-schedule to run tasks at certain times in the future (multiple hours). node-schedule uses setTimeout() to accomplish the delayed invocations.

Short times work just fine, but long times will not fire until I manually 'poke'/wake the process by sending a request to the server.

I invoke the process with nohup node server.js & and then leave the shell.

Several hours later, after the timeout should have fired, I ssh back into the server and verify that the process is still running (listed in top). However, nothing happens until I send a request to the server and then all the past timeouts run at once (verified by logging).

It seems the process is asleep, preventing timeouts from firing, and the only thing that wakes the process is an HTTP request.

How can I solve this?

cemulate
  • 2,305
  • 1
  • 34
  • 48
  • This question provides some possible alternatives that might help: [Node.js setTimeout for 24 hours - any caveats?](http://stackoverflow.com/questions/30104673/node-js-settimeout-for-24-hours-any-caveats) – Yogi Jan 07 '16 at 19:08

0 Answers0