Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1697 มุมมอง

Why do some sessions expire shortly after they are created?

I debugged the session_gc method, thinking it might be the root cause of the issue. Right away, I noticed a check involving random.random(). The condition if random.random() implies that there's a 0.1% probability (or 1 in 1000) of proceeding with the cleanup. This led me to consider the possibility that a session could be created and immediately fall under this rule for cleanup.

However, it attempts to check if the file was last modified before the specified date in last_week using os.path.getmtime(path). If the modification date is earlier than last_week, the file is deleted with os.unlink(path). It's important to note that this check is applied to all sessions. The session I created yesterday doesn't meet the condition of being earlier than last_week, so it should not be deleted.


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
พ.ย. 15
5740
0
ธ.ค. 21
3046
1
พ.ย. 16
9057
Send data outside Odoo using python แก้ไขแล้ว
1
ต.ค. 21
3077
1
ส.ค. 15
7813