Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: duplicate connections inserted for a usersSession #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emaciel10
Copy link

@emaciel10 emaciel10 commented Jun 5, 2020

When digging into an issue where our users were showing as always online. We took the approach of regularly cleaning up any 'stale' usersSessions since especially during deploys we noticed that certain usersSessions were not getting removed even though the instances no longer existed in the instances collection.

Here is a screenshot of the cleanup batch job:
image

It seems like the logic here does not run on our aws deploys since the users that are stuck in this permanently online state seem to be connected to instances that no longer exist.

image

A secondary and perhaps minor issue we noticed was that usersSessions had duplicate connections to the same instance with the same connectionId:

{ 
    "_id" : "rnrNGnNhiyqoywgD3", 
    "connections" : [
        {
            "id" : "jr6kwLY7rWFQaBPx6", 
            "instanceId" : "EpuQbnoXPvCkKb7yA", 
            "status" : "online", 
            "_createdAt" : ISODate("2020-06-05T21:27:32.698+0000"), 
            "_updatedAt" : ISODate("2020-06-05T21:27:32.698+0000")
        }, 
        {
            "id" : "jr6kwLY7rWFQaBPx6", 
            "instanceId" : "EpuQbnoXPvCkKb7yA", 
            "status" : "online", 
            "_createdAt" : ISODate("2020-06-05T21:27:31.238+0000"), 
            "_updatedAt" : ISODate("2020-06-05T21:27:31.238+0000")
        }, 
    ]
}

This PR fixes that duplicate connection issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant