Skip to content

feat(gmail): share a cross-process request token bucket - #83

Open
MaximeGaudin wants to merge 1 commit into
mainfrom
feat/gmail-rate-limit
Open

feat(gmail): share a cross-process request token bucket#83
MaximeGaudin wants to merge 1 commit into
mainfrom
feat/gmail-rate-limit

Conversation

@MaximeGaudin

Copy link
Copy Markdown
Owner

Summary

  • CLI and sync daemon share a SQLite token bucket (~90 requests / 60s per Gmail account) so they do not stampede the same per-minute quota window.
  • Hooked once in send_retrying (every Gmail HTTP attempt, including retries). Sleeps outside BEGIN IMMEDIATE.
  • Missing or unreadable store fails open. Wiremock tests using with_base_url have no limiter.

Tracks the cross-process leftover from #79 (retry in #80, store-first in #82).

Test plan

  • Two processes against the same store (CLI search + sync) no longer burst 90+ Gmail calls in one second
  • First run with no void.db still talks to Gmail (fail open)
  • Existing Gmail wiremock tests stay fast (with_base_url has no limiter)
  • After a 403 quota error, retry backoff plus this bucket keep the next minute from amplifying the stampede

CLI and sync daemon serialize on a SQLite bucket (~90 req/min per account)
so they stop stampeding the same per-minute quota window. Fail open if the store is missing.

Co-authored-by: Cursor <cursoragent@cursor.com>
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