Repository navigation
order-inbox: answer unchanged polls from a change marker instead of a KV list - #283
Merged
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.