fix: Support short session idle durations (#36773)
closes https://github.com/frappe/frappe/issues/35209
This commit is contained in:
parent
b39800e5aa
commit
4e91b1a281
1 changed files with 3 additions and 1 deletions
|
|
@ -416,10 +416,12 @@ class Session:
|
||||||
last_updated = self.data.data.last_updated
|
last_updated = self.data.data.last_updated
|
||||||
time_diff = frappe.utils.time_diff_in_seconds(now, last_updated) if last_updated else None
|
time_diff = frappe.utils.time_diff_in_seconds(now, last_updated) if last_updated else None
|
||||||
|
|
||||||
|
threshold = min(get_expiry_in_seconds() / 2, 600) or 600
|
||||||
|
|
||||||
# database persistence is secondary, don't update it too often
|
# database persistence is secondary, don't update it too often
|
||||||
updated_in_db = False
|
updated_in_db = False
|
||||||
if (
|
if (
|
||||||
force or (time_diff is None) or (time_diff > 600) or self._update_in_cache
|
force or (time_diff is None) or (time_diff > threshold) or self._update_in_cache
|
||||||
) and not frappe.flags.read_only:
|
) and not frappe.flags.read_only:
|
||||||
self.data.data.last_updated = now
|
self.data.data.last_updated = now
|
||||||
self.data.data.lang = str(frappe.lang)
|
self.data.data.lang = str(frappe.lang)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue