We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent de0bacd commit a7f4d6bCopy full SHA for a7f4d6b
src/fipe/client.ts
@@ -50,8 +50,12 @@ export class FipeClient {
50
51
private recordSuccess(): void {
52
this.successCount++;
53
- if (this.successCount >= 10 && this.currentThrottleMs > env.RATE_LIMIT_MS) {
54
- const newThrottle = Math.max(this.currentThrottleMs - 50, env.RATE_LIMIT_MS);
+ // After 5 consecutive successes, halve the distance to baseline
+ if (this.successCount >= 5 && this.currentThrottleMs > env.RATE_LIMIT_MS) {
55
+ const newThrottle = Math.max(
56
+ Math.floor((this.currentThrottleMs + env.RATE_LIMIT_MS) / 2),
57
+ env.RATE_LIMIT_MS,
58
+ );
59
if (newThrottle !== this.currentThrottleMs) {
60
console.log(
61
`Throttle recovery: decreasing from ${this.currentThrottleMs}ms to ${newThrottle}ms`,
0 commit comments