recordRateLimit method
Record a rate limit (429) response. Returns the recommended backoff.
Implementation
Duration recordRateLimit() {
_consecutiveRateLimits++;
final backoffMs = (pow(2, _consecutiveRateLimits) * 1000).toInt().clamp(
1000,
60000,
);
final jitter = Random().nextInt(500);
return Duration(milliseconds: backoffMs + jitter);
}