ton-provider-system 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1363,6 +1363,8 @@ var TokenBucketRateLimiter = class {
|
|
|
1363
1363
|
this.config.maxBackoffMs
|
|
1364
1364
|
);
|
|
1365
1365
|
}
|
|
1366
|
+
this.tokens = 0;
|
|
1367
|
+
this.lastRefill = Date.now();
|
|
1366
1368
|
this.logger.warn(`Rate limit hit, backoff: ${this.currentBackoff}ms, errors: ${this.consecutiveErrors}`);
|
|
1367
1369
|
}
|
|
1368
1370
|
/**
|
|
@@ -1895,7 +1897,8 @@ var _ProviderManager = class _ProviderManager {
|
|
|
1895
1897
|
this.rateLimiter = createRateLimiterManager(this.options.logger);
|
|
1896
1898
|
for (const provider of this.registry.getAllProviders()) {
|
|
1897
1899
|
const config2 = getRateLimitForType(provider.type);
|
|
1898
|
-
const
|
|
1900
|
+
const bufferMultiplier = provider.rps <= 3 ? 1.2 : 1.1;
|
|
1901
|
+
const minDelayMs = Math.ceil(1e3 / provider.rps * bufferMultiplier);
|
|
1899
1902
|
let burstSize;
|
|
1900
1903
|
if (provider.rps <= 3) {
|
|
1901
1904
|
burstSize = 1;
|