https://gitlab.synchro.net/main/sbbs/-/commit/ec781cef7634cf0256c704c3
Modified Files:
webv4/lib/forum.js
Log Message:
webv4: take a poll's tally from the sub's threads, not every header
getUserPollData() called get_all_msg_headers() on the whole sub to find
one poll's tally, which get_msg_header() doesn't provide. A thread view
does this for every poll it shows, so a page with 8 polls in a 5,145
message sub spent 393 ms on it.
The tally is now taken from getMessageThreads(), which caches it with
the rest of the sub's threads. A thread view has already loaded those
threads, so its polls reuse them: that page now spends 14 ms. The
poll's other fields come from get_msg_header(). A poll that isn't in the threads (such as one older than max_messages) still falls back to
reading every header.
getUserPollData() now also requires that the user can read the sub, as getMessageThreads() does; before, any user could read the tally and
answers of a poll in a sub they had no access to.
Results were identical to the previous code for all 25 polls on a
production install.
Part of #1339.
Co-Authored-By: Claude Opus 5.5 <
noreply@anthropic.com>
---
■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net