Skip to content

fix(fetcher): limit fetch chunks#1346

Merged
andrinoff merged 1 commit into
floatpane:masterfrom
puneetdixit200:fix/1106-fetch-limit-chunk-size
May 23, 2026
Merged

fix(fetcher): limit fetch chunks#1346
andrinoff merged 1 commit into
floatpane:masterfrom
puneetdixit200:fix/1106-fetch-limit-chunk-size

Conversation

@puneetdixit200
Copy link
Copy Markdown
Contributor

@puneetdixit200 puneetdixit200 commented May 22, 2026

What?

  • remove the hard 50-message minimum chunk size in FetchMailboxEmails
  • add a TLS IMAP recorder regression that verifies limit=5 fetches only 96:100 from a 100-message mailbox

Why?

When callers request a small page, the fetcher should not over-fetch 50 messages before filtering and trimming. This keeps IMAP bandwidth and server load proportional to the requested limit.

Fixes #1106

@puneetdixit200 puneetdixit200 requested a review from a team as a code owner May 22, 2026 13:57
Copy link
Copy Markdown
Member

@floatpanebot floatpanebot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @puneetdixit200! Please fix the following issues with your PR:

  • Title: Is too long (40 characters). The PR title must be strictly under 40 characters.
  • Body: Missing the ## What? or ## Why? headings required by the PR template.

@floatpanebot floatpanebot added area/fetcher IMAP fetch / IDLE / search bug Something isn't working size/L Diff: 201–800 lines labels May 22, 2026
@puneetdixit200 puneetdixit200 changed the title fix(fetcher): respect small fetch limits fix(fetcher): limit fetch chunks May 22, 2026
@floatpanebot floatpanebot dismissed their stale review May 22, 2026 13:58

Formatting issues have been resolved. Thank you!

@andrinoff andrinoff force-pushed the fix/1106-fetch-limit-chunk-size branch from 67f8a5c to a06aed1 Compare May 23, 2026 09:59
@floatpanebot
Copy link
Copy Markdown
Member

floatpanebot commented May 23, 2026

Benchmark report — no significant change

Metrics worse: 0 · better: 0 (threshold: ±3%).

benchstat output
goos: linux
goarch: amd64
pkg: github.com/floatpane/matcha/backend
cpu: AMD EPYC 9V74 80-Core Processor                
                           │   old.txt    │              new.txt               │
                           │    sec/op    │    sec/op     vs base              │
ParseSearchQuery_Simple-4    3.018µ ± 87%   2.484µ ± 39%       ~ (p=0.699 n=6)
ParseSearchQuery_Complex-4   6.874µ ± 42%   5.787µ ± 48%       ~ (p=0.699 n=6)
TokenizeSearchQuery-4        4.005µ ± 20%   4.574µ ± 37%       ~ (p=0.240 n=6)
geomean                      4.363µ         4.036µ        -7.50%

                           │  old.txt   │              new.txt               │
                           │    B/op    │    B/op     vs base                │
ParseSearchQuery_Simple-4    26.00 ± 0%   26.00 ± 0%       ~ (p=1.000 n=6) ¹
ParseSearchQuery_Complex-4   762.0 ± 0%   762.0 ± 0%       ~ (p=1.000 n=6) ¹
TokenizeSearchQuery-4        176.0 ± 0%   176.0 ± 0%       ~ (p=1.000 n=6) ¹
geomean                      151.6        151.6       +0.00%
¹ all samples are equal

                           │  old.txt   │              new.txt               │
                           │ allocs/op  │ allocs/op   vs base                │
ParseSearchQuery_Simple-4    2.000 ± 0%   2.000 ± 0%       ~ (p=1.000 n=6) ¹
ParseSearchQuery_Complex-4   23.00 ± 0%   23.00 ± 0%       ~ (p=1.000 n=6) ¹
TokenizeSearchQuery-4        9.000 ± 0%   9.000 ± 0%       ~ (p=1.000 n=6) ¹
geomean                      7.453        7.453       +0.00%
¹ all samples are equal

pkg: github.com/floatpane/matcha/tui
                    │   old.txt    │               new.txt               │
                    │    sec/op    │    sec/op     vs base               │
LogPanelView-4        158.3µ ± 12%   175.0µ ± 13%        ~ (p=0.240 n=6)
SearchOverlayView-4   170.7µ ±  9%   195.2µ ± 35%        ~ (p=0.065 n=6)
InboxConstruction-4   560.9µ ± 56%   769.2µ ± 21%        ~ (p=0.093 n=6)
geomean               247.5µ         297.2µ        +20.11%

                    │    old.txt    │               new.txt                │
                    │     B/op      │     B/op       vs base               │
LogPanelView-4        33.23Ki ± 34%   44.67Ki ±  0%        ~ (p=0.238 n=6)
SearchOverlayView-4   44.67Ki ± 26%   56.14Ki ± 41%        ~ (p=0.318 n=6)
InboxConstruction-4   874.0Ki ±  0%   874.0Ki ±  0%        ~ (p=0.260 n=6)
geomean               109.1Ki         129.9Ki        +19.10%

                    │   old.txt   │              new.txt              │
                    │  allocs/op  │  allocs/op   vs base              │
LogPanelView-4         713.0 ± 0%    714.0 ± 0%       ~ (p=0.182 n=6)
SearchOverlayView-4    925.0 ± 0%    926.0 ± 0%       ~ (p=0.924 n=6)
InboxConstruction-4   3.476k ± 0%   3.476k ± 0%       ~ (p=0.545 n=6)
geomean               1.319k        1.320k       +0.08%

auto-generated by benchmarks.yml

@puneetdixit200 puneetdixit200 force-pushed the fix/1106-fetch-limit-chunk-size branch from a06aed1 to 3ad4bb5 Compare May 23, 2026 10:10
@andrinoff andrinoff force-pushed the fix/1106-fetch-limit-chunk-size branch from 3ad4bb5 to 423ceba Compare May 23, 2026 10:12
@andrinoff andrinoff force-pushed the fix/1106-fetch-limit-chunk-size branch from 423ceba to 3c691ae Compare May 23, 2026 16:40
@andrinoff andrinoff merged commit ec1bdbf into floatpane:master May 23, 2026
40 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/fetcher IMAP fetch / IDLE / search bug Something isn't working size/L Diff: 201–800 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Fetcher chunkSize over-fetches when caller asks for fewer than 50

4 participants