• webv4/lib/forum.js

    From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Sun Nov 15 00:36:36 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/ae16d34d42f38a4ad578372f
    Modified Files:
    webv4/lib/forum.js
    Log Message:
    webv4: name thread cache temp files correctly, remove abandoned ones

    The temporary file a sub's thread cache is written to was named with format('%d', Date.now()), which overflows a 32-bit int, so every name
    carried -2147483648 and only the random suffix kept them apart. And a
    write that never finished (the request aborted, or the script was
    stopped mid-write) left its partial temp file in data/webv4/threads/ indefinitely.

    Name the file with the full millisecond time, and before writing a
    sub's cache, remove that sub's temp files older than 10 minutes. A
    complete rewrite of the largest sub measured takes about 10 seconds, so
    that age is never a write still in progress.

    Follows d7197cf656 (pushed-21-bodies, 2026-11-13). Part of #1339.

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Sun Nov 15 00:36:36 2026
    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>
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)