sorenlouv / fb-sleep-stats

Use Facebook to track your friends’ sleeping habits
https://medium.com/@sqrendk/how-you-can-use-facebook-to-track-your-friends-sleeping-habits-505ace7fffb6
MIT License
1.61k stars 314 forks source link

Scrape stop automatically after 3 hours #74

Open cfanjie opened 8 years ago

cfanjie commented 8 years ago

I run the fb-sleep-stats from Amazon EC2 & Google Cloud VM. I did the following: $ npm start & $ npm run scrape & $ disown

The scrape runs normal in the first 3 hours. But always stop automatically after like 3 hours. As I figured out there's no data coming in, the process is no longer exist in '$ ps -aux'. Any solution or suggestions?

sorenlouv commented 8 years ago

Do you see any exceptions in the logs? I use forever which will restart the script if terminated.

sorenlouv commented 8 years ago

Try adding the following to scrape.js:

// Avoid crashing the node process by handling uncaught exceptions
process.on('uncaughtException', function(err) {
    console.error('Uncaught exception:', err, err.stack);
});
jmichalek132 commented 8 years ago

@sqren solved by adding handling uncaught exceptions.