fn is_rate_limited(snapshot: &UsageSnapshot) -> boolExpand description
True when ANY window in the snapshot is currently at-or-beyond the plan cap AND its scheduled reset has not yet passed. Such an account will immediately trip the API rate limit on the next request, so it’s excluded from the “available” tier and only used as a fallback when every pinned account is rate-limited.
Each window’s predicate (UsageWindow::is_currently_limited) gates
on resets_at so a stale cached snapshot from before the window
reset doesn’t keep the account permanently classified as
rate-limited. The pair “utilization >= 100% AND resets_at > now”
is what makes the classification self-clearing across the reset
boundary - earlier shapes that checked utilization alone needed
a separate cache-invalidation pathway, which has churned through
several abandoned designs.