ton-provider-system 0.1.2 → 0.1.3
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 +11 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1898,10 +1898,20 @@ var _ProviderManager = class _ProviderManager {
|
|
|
1898
1898
|
this.rateLimiter = createRateLimiterManager(this.options.logger);
|
|
1899
1899
|
for (const provider of this.registry.getAllProviders()) {
|
|
1900
1900
|
const config2 = getRateLimitForType(provider.type);
|
|
1901
|
+
const minDelayMs = Math.ceil(1e3 / provider.rps * 1.1);
|
|
1902
|
+
let burstSize;
|
|
1903
|
+
if (provider.rps <= 3) {
|
|
1904
|
+
burstSize = 1;
|
|
1905
|
+
} else if (provider.rps <= 5) {
|
|
1906
|
+
burstSize = 2;
|
|
1907
|
+
} else {
|
|
1908
|
+
burstSize = Math.max(3, Math.ceil(provider.rps * 1.5));
|
|
1909
|
+
}
|
|
1901
1910
|
this.rateLimiter.setConfig(provider.id, {
|
|
1902
1911
|
...config2,
|
|
1903
1912
|
rps: provider.rps,
|
|
1904
|
-
minDelayMs
|
|
1913
|
+
minDelayMs,
|
|
1914
|
+
burstSize
|
|
1905
1915
|
});
|
|
1906
1916
|
}
|
|
1907
1917
|
this.healthChecker = createHealthChecker(
|