Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

presence: Change server-side OFFLINE_THRESHOLD_SECS to 140s.

Mateusz Mandera4ba4305ff9f4
diff --git a/zerver/actions/message_send.py b/zerver/actions/message_send.py
index 45d3d8ed016..6b62928dbd7 100644
--- a/zerver/actions/message_send.py
+++ b/zerver/actions/message_send.py
@@ -696,10 +696,7 @@ def filter_presence_idle_user_ids(user_ids: Set[int]) -> List[int]:
if not user_ids:
return []
- # Matches presence.js constant
- OFFLINE_THRESHOLD_SECS = 140
-
- recent = timezone_now() - datetime.timedelta(seconds=OFFLINE_THRESHOLD_SECS)
+ recent = timezone_now() - datetime.timedelta(seconds=settings.OFFLINE_THRESHOLD_SECS)
rows = (
UserPresence.objects.filter(
user_profile_id__in=user_ids,
diff --git a/zproject/default_settings.py b/zproject/default_settings.py
index 1e2c7a3f5df..0894ffe2a1a 100644
--- a/zproject/default_settings.py
+++ b/zproject/default_settings.py
@@ -488,10 +488,8 @@ LOG_API_EVENT_TYPES = False
STAGING = False
# How long to wait before presence should treat a user as offline.
-# TODO: Figure out why this is different from the corresponding
-# value in static/js/presence.js. Also, probably move it out of
-# default_settings, since it likely isn't usefully user-configurable.
-OFFLINE_THRESHOLD_SECS = 5 * 60
+# Should match the presence.js constant.
+OFFLINE_THRESHOLD_SECS = 140
# Specifies the number of active users in the realm
# above which sending of presence update events will be disabled.