Terminate single user session after X amount of time

Hello everyone,

I have a dash app working and I am happy with it. I deployed the app with gunicorn and whatnot and now have users. The app has a fair amount of rendering and computation thus it takes a fair amount of ressources on the server side. Some users might forgot to close the app in their web-browser even when they do not need it and some tabs will require constant resources via live data update for instance.

Since ressources is finite, I would like if possible, to terminate individual user session let’s say 24 hours after they opened the app in their browser. I do not want to terminate my gunicorn processes as other users might be really using the app. One gunicorn worker is dealing with multiple sessions at once.

Any tip on how to do it?

Thanks!