问题
This answer suggests that it's possible to attach to "on session end" event in Django. However, this event seems to be called only when Django deletes the session from the database (please, correct me if I'm wrong). Does this happen only upon a request from the browser that has this session's cookie, or is there a background thread in Django that deletes sessions from the DB when they expire and calls "on sessssion end" event (more precisely, issues pre_delete
signal)?
Some context: I'm writing an application that allocates some resources when the session is created. And I need to deallocate these resources when the session expires.
来源:https://stackoverflow.com/questions/54170116/do-sessions-in-django-expire-without-a-request