mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 16:13:15 +00:00
The unified scope is rebuilt on every connection while a browser restores its logins, on every background push, and on every unified browse, load-more and search - and each build asked every login for its folders again, one login after the other. With ten logins that was ten full Mailbox/get per build and well over a hundred in the first seconds, and the slowest build waited on the sum of every login's round trip. Fetch the logins in parallel, and fetch each login's list once: a build shares a fetch that is already in flight and reuses a finished one until that login reports a change - the push handlers invalidate the login they hear from, so a background push now costs one Mailbox/get instead of one per login. A 60 s limit backstops a change whose push was lost. A reused list is never written back into `accountMailboxes`: optimistic updates land there directly, and publishing an older list over them would snap a just-changed counter back.