Wow! This might take out the need to have a watchdog process to restart the
server. Very nice!
Am 19.09.2014 um 05:41 schrieb Lellansin Huang <[email protected]>:
> Um.. I write a module for auto reload module without shutdown the server. It
> can be used like this:
>
> var reload = require('auto-reload');
> var data = reload('./data', 3000); // reload every 3 secs
>
> // print data every sec
> setInterval(function() {
> console.log(data);
> }, 1000);
> And if you update the file data.json or .js, the var data can be auto
> reloaded.
>
> I did this by;
>
> delete require.cache[whole];
> var update = require(whole);
> // clone new module data to old reference
> clone(module, update);
> It's very simple, you can see more detail on
> https://github.com/Lellansin/node-reload .
>
> I just want to discuss the possible negative effect or problem, and how to
> fix or improve.
>
> Thanks a lot if you reply.
>
> --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/42d5a93e-d99b-411f-87da-5deb506b5935%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/53AFD6BA-015D-4A74-85F4-DC15D29CADEF%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.