On Mon, Feb 18, 2013 at 7:05 PM, Federico Kereki <[email protected]> wrote:
> I'm guessing that you could have a process running periodically, which > would monitor loaded modules for updates and, if needed, "require(...)" > them again after having done a "delete require.cache[...]". > This is actually very different than what PHP does. In PHP, you have nothing shared across requests (unless you're sharing through an external service). In node, if you re-require() a module, you're going to kill any state that was being tracked inside that module. You'll also need to write your code in a different style than you normally would because you wouldn't want to hold on to module references. You'd also need to make sure that your old and new code can work together. With PHP, you're getting a clean slate on every request. You *can* setup your node server to work this way, but you probably won't. > My only hard-and-fast requirement is that no connection is lost because of > the restart -- connected users shouldn't notice any change at all, though I > could stand a certain delay. > You'll need to write logic for a graceful shutdown so that you can send a signal to your process and have it stop accepting new requests, but not exit until it has finished serving all the requests that it has already received. If you don't want to miss any connections, you'll probably want to have a few processes running on different ports and have a balancer in front. You can stagger the restarts to avoid down time. What's the best way? It's likely going to depend on your server/network architecture. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: 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 post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- 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]. For more options, visit https://groups.google.com/groups/opt_out.
