Skip to content

Commit 576ea4d

Browse files
committed
fix: adjust throttle
1 parent 55c4efa commit 576ea4d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/fipe/client.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,9 @@ export class FipeClient {
5050

5151
private recordSuccess(): void {
5252
this.successCount++;
53-
// After 5 consecutive successes, halve the distance to baseline
54-
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-
);
53+
// After 10 consecutive successes, reduce throttle by 25%
54+
if (this.successCount >= 10 && this.currentThrottleMs > env.RATE_LIMIT_MS) {
55+
const newThrottle = Math.max(Math.floor(this.currentThrottleMs * 0.75), env.RATE_LIMIT_MS);
5956
if (newThrottle !== this.currentThrottleMs) {
6057
console.log(
6158
`Throttle recovery: decreasing from ${this.currentThrottleMs}ms to ${newThrottle}ms`,

0 commit comments

Comments
 (0)