https://gitlab.synchro.net/main/sbbs/-/commit/8561162afd411996186b7f0a
Modified Files:
exec/load/presence_lib.js web/root/ecwebv3/sidebar/002-whosOnline.ssjs webv4/lib/events/nodelist.js webv4/root/api/system.ssjs
Log Message:
node lists: don't lock a user record just to display node status
Reading a user record locks its byte range in user.tab, so building a
User object is not free. The node-list code built ones it never used,
turning a cheap status display into lock contention on a single hot
record - usually user #1's, which was hard-coded.
nodelist.js, the system.ssjs node-list API and ecwebv3's whosOnline
sidebar each did `new User(1)` purely to get an object, then assigned usr.number over it. The constructor reads eagerly for any non-zero
number, so record #1 was read and discarded every time. new User()
skips the read, and assigning .number already invalidates the cache.
node_status() cost more: a User per in-use node, per call, even when the
caller wanted neither age nor gender - true of both webv4 callers, which
pass exclude_username. Build it only when include_age or include_gender
is set and take the alias from system.username() otherwise; that reads
the name index and takes no lock, as the NODE_LOGOUT case already did.
(The index reads "DELETED USER" for a deleted account, which can't be
the case for a node that is in use.) The anonymous-node path no longer
reads a record it was about to discard either.
Output is unchanged: verified against the previous implementation over
six option sets, both is_sysop values and every node. With the options
webv4 passes, listing nodes now reads no user record at all; with include_age/include_gender it reads one per in-use node, as before.
Fixes the bursts of "Error -104 reading user number 1"
(USER_LOCK_ERROR) logged by the node-list event stream whenever
something held record #1 for a while - nightly maintenance, or a
terminal user's own post accounting.
Co-Authored-By: Claude Opus 5 (1M context) <
noreply@anthropic.com>
---
■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net