Hi!
I have a nightly sync that runs and this can be problematic if active users are on (they’re subscribed to some expensive subs)
I’m currently logging any open WSs prior to the sync
const activeSockets = Meteor.server.stream_server.open_sockets; console.log(
amt of activeUsers are ${activeSockets.length} ${new Date()}); if (activeSockets && activeSockets.length) { for (let socket of activeSockets) { console.log(
${inspect(socket)} ${new Date()}`);
//Exposing the underlying SockJS Object and doing something like the following seems to close the connection
//socket.close()
}
}`
The above works to list metadata about any open sockets. My commented out code seems to work when playing around locally. I.e. I call the socket.close
and see my client connection close on its console too. However…my problem is that the connection immediately opens up again. I’m thinking this is due to the Meteor.user
being automatically logged in because their tab is still technically open.
Looks like doing something like Meteor.users.update({}, {$set : { "services.resume.loginTokens" : [] }}, {multi:true});
could be what I need. Although I haven’t tested it yet.
Any other patterns or ideas to this? What is the community doing for problems like this?
Ultimately, I aim to spin up another server to handle these syncs that’s outside the web server that clients interact with. But…I may need to issue out this fix prior if need be. Thanks!