Please sign in to comment.
Avoid continue reloading due to atime changes
watchFile() will watch for any changes to the file, including the file's meta-data, such as its atime. The atime is updated whenever a file is opened. When the server is restarted, it re-opens the script file, which updates the atime, which then causes the watchFile() event to fire again. This changes explicitly checks the mtime and ctime fields, and only restarts the server if these differ (ignoring atime changes). Additionally, an nterval is specified in watchFile() so that when inotify is not available checks occur every 0.5 seconds, rather than every 5 seconds.
- Loading branch information...