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