0
votes

i know that i can set the session to expire when user close the browser, and this is good. now i need a next step. The problem is this: The can start an action by clicking the button "start". This creates a tuple which is sotred in the database. This has a field called "status" that is set to IN PROGRESS. When the user push the button "end" i change the value of the status to FINISHED

Now, if between the "start" and "end" the user close the browser the session expires. What i want to do is to being able to intercept that the session is expired and remove the tuple from the database.

Basically what i want to do is run a function when session expires.

1

1 Answers

0
votes

The session 'expires' by having the cookie on the browser expire, so your django server won't actually know when this occurs.

What I would do in your case, is delete the old data in a cron or celery job periodically.