Skip to content

order-inbox: answer unchanged polls from a change marker instead of a KV list - #283

Merged
frindle merged 4 commits into
mainfrom
order-inbox-fewer-lists
Dec 1, 2026
Merged

frindle merged 4 commits into
mainfrom
order-inbox-fewer-lists

Conversation

@frindle

@frindle frindle commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Keeps the order-inbox KV LIST count far below the free 1,000/day cap.

Cause: the inbox is listed once per 5-minute run (12/hour); when inbox triage is on, its recognized-sender check lists it a second time in the same run (24/hour). Other callers (Email tab sync, auth login, backfills) add more.

Fix: the worker stores a change marker (meta:rev), rewritten on every email write, archive copy and delete. GET /messages and /archive accept ?rev= and answer {unchanged:true} with one KV read. The tracker caches the last listing per worker and area, so all callers share it, and re-lists at least hourly (covers KV expiry). Old tracker with new worker, or new tracker with old worker, both work (no rev means a full list as before).

Deploy: worker first, then tracker.

… KV list

Lists doubled to 24/hour when a second caller (inbox triage's recognized-sender
check) began listing the inbox on every 5-minute run. The worker now keeps one
marker key bumped on every write, archive and delete; GET /messages and /archive
accept the marker last seen and answer unchanged with one read. The tracker keeps
the last listing per worker and area, so every caller in a run shares it, and
still re-lists at least hourly.
@frindle
frindle merged commit 0c6c3de into main Dec 1, 2026
6 checks passed
@frindle
frindle deleted the order-inbox-fewer-lists branch December 1, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant