Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
presence: Tweak and document presence tuning values.
Mateusz Mandera52515a1560fd
diff --git a/frontend_tests/node_tests/activity.js b/frontend_tests/node_tests/activity.jsindex 1b3bbf97f14..853757d70c6 100644--- a/frontend_tests/node_tests/activity.js+++ b/frontend_tests/node_tests/activity.js@@ -577,8 +577,8 @@ test("update_presence_info", ({override}) => {override(pm_list, "update_private_messages", () => {});page_params.realm_presence_disabled = false;- page_params.server_presence_ping_interval_seconds = 50;- page_params.server_presence_offline_threshold_seconds = 140;+ page_params.server_presence_ping_interval_seconds = 60;+ page_params.server_presence_offline_threshold_seconds = 200;const server_time = 500;const info = {diff --git a/frontend_tests/node_tests/buddy_data.js b/frontend_tests/node_tests/buddy_data.jsindex 6c4244f6210..0c1e327f9ea 100644--- a/frontend_tests/node_tests/buddy_data.js+++ b/frontend_tests/node_tests/buddy_data.js@@ -422,7 +422,7 @@ test("always show me", () => {});test("level", () => {- page_params.server_presence_offline_threshold_seconds = 140;+ page_params.server_presence_offline_threshold_seconds = 200;add_canned_users();assert.equal(buddy_data.level(me.user_id), 0);diff --git a/frontend_tests/node_tests/presence.js b/frontend_tests/node_tests/presence.jsindex afc770a86c1..d8eb0622b5e 100644--- a/frontend_tests/node_tests/presence.js+++ b/frontend_tests/node_tests/presence.js@@ -15,7 +15,7 @@ const people = zrequire("people");const watchdog = zrequire("watchdog");const presence = zrequire("presence");-const OFFLINE_THRESHOLD_SECS = 140;+const OFFLINE_THRESHOLD_SECS = 200;const me = {email: "[email protected]",diff --git a/zproject/default_settings.py b/zproject/default_settings.pyindex 3c843bd977c..1effcbdaad1 100644--- a/zproject/default_settings.py+++ b/zproject/default_settings.py@@ -487,14 +487,26 @@ LOG_API_EVENT_TYPES = False# TODO: Replace this with a smarter "run on only one server" system.STAGING = False-# How long to wait before presence should treat a user as offline.-OFFLINE_THRESHOLD_SECS = 140-+# Presence tuning parameters. These values were hardcoded in clients+# before Zulip 7.0 (feature level 164); modern clients should get them+# via the /register API response, making it possible to tune these to+# adjust the trade-off between freshness and presence-induced load.+#+# The default for OFFLINE_THRESHOLD_SECS is chosen as+# `PRESENCE_PING_INTERVAL_SECS * 3 + 20`, which is designed to allow 2+# round trips, plus an extra in case an update fails. See+# https://zulip.readthedocs.io/en/latest/subsystems/presence.html for+# details on the presence architecture.+#+# How long to wait before clients should treat a user as offline.+OFFLINE_THRESHOLD_SECS = 200# How often a client should ping by asking for presence data of all users.-PRESENCE_PING_INTERVAL_SECS = 50--# Specifies the number of active users in the realm-# above which sending of presence update events will be disabled.+PRESENCE_PING_INTERVAL_SECS = 60+# Zulip sends immediate presence updates via the events system when a+# user joins or becomes online. In larger organizations, this can+# become prohibitively expensive, so we limit how many active users an+# organization can have before these presence update events are+# disabled.USER_LIMIT_FOR_SENDING_PRESENCE_UPDATE_EVENTS = 100# How many days deleted messages data should be kept before being