I run Stalwart with blobs on Cloudflare R2. Opening a folder in Bulwark felt painfully slow, so I dug in and found the server was fetching blobs one by one. That sent me down a rabbit hole.
On my real mailbox, loading about 100 messages with bodies went from roughly 6.5-7.5 s down to about 1.5-1.7 s with a local patch. I tried to keep behavior the same as upstream: same order of results, capped concurrency, and limits so one busy account cannot hammer GetObject. No public API changes.
I write Go for work; this is my first Rust contribution here. I went through the changes and tested them myself, and I am happy to rework anything that does not match your style.
Branch:
Would a maintainer mind taking a look and vouching me so I can open a PR? Happy to sign the FLA.
I’m sorry but your PR is not acceptable. If Bulwark is fetching all blobs when opening a folder then it’s doing things wrong. All the information needed to display the message list (headers, preview, size, etc) is available in the data store. Also, even if Bulwark wanted to speed up blob access, they could send multiple blob requests in parallel over HTTP.
I kind of expected that. I am not a frontend developer, I just like doing interesting things because I can, so I went down that rabbit hole anyway
Appreciate you taking a look.
I do still wonder whether bounded parallel reads would help legitimate bulk body fetches (for example IMAP FETCH BODY over many UIDs), but I understand if that is out of scope for now.