Add --max-rps throttle for exchange-graph and exchange-ews #76

Merged
jcoffey-dev merged 1 commits from feat/migrate-max-rps into main 2026-11-13 01:20:37 +00:00
1 Commits
Author SHA1 Message Date
jcoffey-dev 763fdca425 Add --max-rps throttle for exchange-graph and exchange-ews
ci / test (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 3m11s
ci / announce (pull_request) Skipped
Microsoft 365 throttles per app and per mailbox. The clients already
honor a 429/503 reactively (its Retry-After, then a shared backoff
across the workers), but nothing let an operator stay under a known
limit in the first place.

--max-rps caps how many requests may start per second across all worker
connections, a proactive throttle. It is off by default (uncapped) and
composes with the connection count: requests in flight are not limited,
only how often a new one begins.

A reusable Pacer lives next to Cooldown in jmap::retry: the interval is
set once after the client is built (like the logger), a zero interval is
free on the hot path, and an idle gap banks no burst credit. Both M365
clients call it at the top of their request loop. Surfaced on the two
HTTP-request importers, where requests-per-second is the natural knob;
for Gmail the lever stays --imap-connections.
2026-11-12 16:37:24 -07:00