]> mop.ddnsfree.com - git repositories - brisk.git/commitdiff
message queue per user tripled, and the ceiling that holds it
authorMatteo Nastasi <nastasi@alternativeoutput.it>
Sun, 13 Sep 2026 10:38:08 +0000 (12:38 +0200)
committerMatteo Nastasi <nastasi@alternativeoutput.it>
Sun, 13 Sep 2026 10:38:08 +0000 (12:38 +0200)
If the client falls behind by more than COMM_N messages the history is lost:
it is sent back to the initial page, splash included. That happens when it
reconnects after a burst, for instance while the garbage collector removes
dozens of disconnected users at once and every removal produces a room
update.

Eighteen messages are few, but they could not be raised on their own: every
queued update carries the complete list of the people present
(standup_content), which with a full room is about 3 KB, and eighteen of
those were already 61 KB against the 65536 of SHM_DIMS_U_MAX. Raising COMM_N
without raising the ceiling would have made shm_put_var fail. The segments
grow by SHM_DIMS_U_DLT at a time, so whoever does not fill the queue pays
nothing.

WARNING: changing COMM_N means the queue indexes (step % COMM_N) no longer
match those the users were saved with. The persisted state has to be wiped:
without that, the tables stay in "sitreser" and never form again. Verified in
the field, in both directions.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014M1jiEq9cHdE5SE5j6vFuE

web/Obj/brisk.phh

index d6165db1c065b33417e1275871473d19f869a3b6..08c58088c8c393a2f94cf4b68ad4aff06cdb46b5 100644 (file)
@@ -39,10 +39,23 @@ define('SHM_DIMS_MAX', SHM_DIMS_MIN + 1048576);
 define('SHM_DIMS_DLT', 65536);
 
 define('SHM_DIMS_U_MIN', 4096);
-define('SHM_DIMS_U_MAX', 65536);
+/* Ceiling of the shared memory per user. It has to stay generous with
+   respect to COMM_N: every queued room update carries the complete list of
+   the people present (see standup_content), which with a full room is of the
+   order of 3 KB. With COMM_N at 54 a full queue is about 180 KB, and the old
+   64 KB would have made shm_put_var fail. The segments grow by
+   SHM_DIMS_U_DLT at a time, so whoever does not fill the queue pays
+   nothing. */
+define('SHM_DIMS_U_MAX', 262144);
 define('SHM_DIMS_U_DLT', 4096);
 
-define('COMM_N', 18);
+/* Length of the message queue per user. If the client falls behind by more
+   than COMM_N messages the history is lost and it is sent back to the initial
+   page, splash included: that happens in bursts, for instance when the
+   garbage collector removes dozens of disconnected users at once and every
+   removal produces a room update. Raised from 18 to 54; see the
+   SHM_DIMS_U_MAX ceiling above, which has to grow together with this. */
+define('COMM_N', 54);
 define('COMM_GEN_N', 50);
 
 define('CHAT_N', 3);