Keeping data up to date

76 views Asked by At

I'm developing a chat room web app that connects users to limited-size rooms. I'm having trouble figuring out how I should keep my data clean. I'm using forms authentication to keep track of users. With it, I'm able to know when users are offline. In my User table, I have RoomID to keep track of where the user is. I need to run a check every 5 minutes that finds users that are offline and set any found to an ambiguous room so they don't take up space in a room while offline. It seems like bad practice to include this code in my app because that means it will execute on every single user's instance every 5 minutes. I only need it to execute globally.

As far as I can see, my options are as follows...

  1. Make a separate app that checks the DB every 5 minutes and sets all offline users to room 1. The drawback to this approach is that I would need a computer online 100% of the time running the app, always monitoring user status.

  2. Include the check in my app. Drawbacks include: multiple unnecessary DB pings, possible crashing due to multiple room deletions at the same time, etc.

Is there another way? Any help is appreciated.

0

There are 0 answers