Tuesday 23 May 2017

prevent NodeJS program from exiting

I am creating NodeJS based crawler, which is working with node-cron package and I need to prevent entry script from exiting, since application should run forever as cron and will execute crawlers at certain periods with logs. In web application, server will listen and will prevent from terminating, but in serverless apps it will exit program after all code is executed and won't wait for crons.

Should I write while(true) loop for that? What is best practices in node for this purpose.

Thanks in advance!



via Aren Hovsepyan

No comments:

Post a Comment