I am facing problem with below scenario, where I need to clear all sessions on my django app with conditions applied.
- Cannot use cron
- Webapp's javascript is requesting server api per minute for health check wether server is active or not
- Upon sever status
offwebapp is automatically logging out and clearing the current user's session. - Problem is I want to clear all users session
- There can be situation like only one user is logged in, others session are active but not on web browser( means they have recently closed the tab)
- Other situation is only one session is there but its idle ( closed tab)
Now how can I thrash all sessions
Two things I came up with is
- Read Last
PIDand store it in db, whenever any user hits url, it will cross check the PID and clear all sessions if PID mismatch occurs ( Not sure asPIDcan be same after restart) - Server restart event should be listened and kill all sessions ( Not sure how to implement,
SIGHUPkind of events)
Project Architecture:
- Linux
- Python2.7 (Django)
- Nginx
Any other suggestions please.