Coder Social home page Coder Social logo

Comments (12)

alexnault avatar alexnault commented on June 3, 2024 2

You guys are awesome; we'll test it when we get a chance and keep you posted!

from socialize-server-presence.

copleykj avatar copleykj commented on June 3, 2024 1

Yeah, I don't see any reason that process.exit() can't be removed completely. Kind of selfish of the package to assume that nothing else will attempt to catch the exit.

from socialize-server-presence.

copleykj avatar copleykj commented on June 3, 2024 1

So basically what's going on here is the server detects that it's own document has been removed from the database. If the server is the currently the "watcher" it'll just recover by reinserting it's document and things will go on as normal.. If it's not the watcher though, this means that another server is and it has just executed any cleanup functions that were registered. This leaves the application in a state that assumes the server has died and no reliable way to recover from this situation, therefore the last resort is to just exit and come back with a fresh consistent state.

The reason for the exit() is that in its current configuration calling process.kill(process.pid, 'SIGHUP') would execute the process.on('SIGHUP') calling the stop method which would try to update the document that's been deleted from the server and run the cleanup functions that were already run. This is an easy fix though and I'll get fixed and released so you guys can get back to worrying about the big issues 😃

from socialize-server-presence.

alexnault avatar alexnault commented on June 3, 2024 1

It worked! During today's deployment, ongoing connections were gradually moved to new containers as expected. Cheers!

from socialize-server-presence.

copleykj avatar copleykj commented on June 3, 2024

Is this the only package in the set that your app uses?

from socialize-server-presence.

alexnault avatar alexnault commented on June 3, 2024

@copleykj Yes, we wrote our own minimalist implementation of socialize-user-presence.

from socialize-server-presence.

copleykj avatar copleykj commented on June 3, 2024

Awesome! We've done a lot of updates to the package set and are really close to a release. Since you guys aren't using any other packages in the set that would cause the dependency resolver to hold back the upgrade of the server presence package I can get this fix in and issue a release just for this package.

from socialize-server-presence.

copleykj avatar copleykj commented on June 3, 2024

There you go.

from socialize-server-presence.

alexnault avatar alexnault commented on June 3, 2024

Hmm, process.exit() is still called on https://github.com/copleykj/socialize-server-presence/blob/master/server-presence.js#L49. Is it intentional?

I don't see why the sync needs to happen both ways. The servers should keep the DB up-to-date and never the other way around.

Here's how I see it - there are 2 possible scenarios when a server document is removed:

  1. Server has already terminated itself.
  2. Server is still online but failed to update the server document in time (it might be in the middle a deployment). It shouldn't be asked to shutdown. It will update the document when it gets the opportunity.

Or maybe I'm missing something? Thoughts?

from socialize-server-presence.

copleykj avatar copleykj commented on June 3, 2024

Should be all set. Let me know if you need anything else.

from socialize-server-presence.

copleykj avatar copleykj commented on June 3, 2024

Hey @anault, just wanted to make sure the fix was satisfactory.

from socialize-server-presence.

alexnault avatar alexnault commented on June 3, 2024

We are deploying the fix this week and then we'll have to test it against another deployment (probably next week). I'll come back with an answer asap.

from socialize-server-presence.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.