Hi Tony.

Have you ever considered using a firewall and routing approach?

For example, on the same server, you can keep open your current node-js 
server and open other in the port 81, for example.

And the trick is, *send only the new users connections *to the new node-js 
server in the port 81.
With time, the users will finish your work in the old node-js server in 
port 80.

You must evaluate well how to do it to avoid latency or even to freeze the 
server.

-- Amanda Osvaldo

On Tuesday, 28 February 2017 14:35:48 UTC-3, Tony Mobily wrote:
>
> I have a very, very busy node application on a production server. The app 
> deals with a real-time chat (using websockets) as well as e-commerce 
> payments. While *everything* is absolutely set so that when the server 
> goes down the clients will reconnect their sockets etc., I still have a 
> problem: whenever the server is stopped, with a SIGINT, the event loop is 
> cut off. This means that any pending DB write (possibly for a financial 
> transaction) is simply discarded. There are two especially crucial moments 
> (when the credit card merchant gives the OK, but *before* we write the 
> record on the db) and at the moment we are shutting it down at off-peak 
> times to prevent any possible problems. But this is bad.
>
> I am thinking of this as a solution:
>
>    - I send a custom UNIX signal to the process (SIGUSR2 for example?);
>    - When server.js gets the signal:
>       - It stops listening to port 80
>       - It waits for the event loop to dry up
>       - If after 10 seconds it's still hanging, it forces the closure 
>       This means that at each reboot the server will be at the most down for 
> 10 
>       seconds.
>    
> Is this what people in the real world do? Any gotcha? How do I check that 
> the event loop is empty?
>
>
>

-- 
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 nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/87a61ad9-b69f-447f-b080-ccac8aec528b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to