I have a C# console based application deployed on ubuntu servers (3 instances at the moment). I have redis server which has a SET for keeping all connected user ids (ulong).
I have logic in place to add user Id to redis SET whenever a user login and remove from SET when a user disconnects. This is working fine.
But there are some cases in which server could crash due to any reason. In those cases, how can a server removes its all connected users from redis SET?
I have tried removing all users using AppDomain.CurrentDomain.ProcessExit, Console.CancelKeyPress & AppDomain.CurrentDomain.UnhandledException, but they are not reliable. Sometimes they removes Users from redis SET and sometimes not.