3

So, I am trying to make a flask session expires after a certain amount of time.

After a user login is validated I set session.permanent = True

In my config I have

PERMANENT_SESSION_LIFETIME = timedelta(minutes=1)
SESSION_REFRESH_EACH_REQUEST = False

and in my global before request:

if request.endpoint != 'static' and not request.is_xhr:
    session.modified = True

This works if the user's logged on my site and then closes the tab, after one minute the session is expired. However I have an AJAX request that is constantly running in background on all pages. If the user is in any of this pages the session never expires.

How can I prevent this behavior?

Felipe Emerim
  • 363
  • 2
  • 12

0 Answers0