From cc2c65c5d05fdbc43893b7b9e0c03bed38ed2874 Mon Sep 17 00:00:00 2001 From: KONFeature Date: Wed, 10 Jul 2024 14:54:36 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Test=20a=20better=20load?= =?UTF-8?q?=20balancing=20split?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ponder.config.ts | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/ponder.config.ts b/ponder.config.ts index 3f6c3ab..25ff843 100644 --- a/ponder.config.ts +++ b/ponder.config.ts @@ -19,16 +19,15 @@ import { import { contentRegistryAbi } from "./abis/frak-registry-abis"; import { multiWebAuthNValidatorV2Abi } from "./abis/multiWebAuthNValidatorABI"; - /** * @description Creates a load balanced transport that spreads requests between child transports using a round robin algorithm. */ export function timestampLoadBalance(_transports: Transport[]): Transport { - return ({chain, retryCount, timeout}) => { + return ({ chain, retryCount, timeout }) => { const transports = _transports.map((t) => chain === undefined - ? t({retryCount: 0, timeout}) - : t({chain, retryCount: 0, timeout}) + ? t({ retryCount: 0, timeout }) + : t({ chain, retryCount: 0, timeout }) ); return createTransport({ @@ -56,8 +55,8 @@ export function timestampLoadBalance(_transports: Transport[]): Transport { } const pollingConfig = { - pollingInterval: 20_000, - maxRequestsPerSecond: 16, + pollingInterval: 15_000, + maxRequestsPerSecond: 24, } as const; export default createConfig({ @@ -72,10 +71,22 @@ export default createConfig({ chainId: 421614, transport: timestampLoadBalance([ http( - `https://arb-sepolia.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}` + `https://arb-sepolia.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`, + { + retryCount: 0, + } + ), + http( + `https://arbitrum-sepolia.blockpi.network/v1/rpc/${process.env.BLOCKPI_API_KEY_ARB_SEPOLIA}`, + { + retryCount: 0, + } ), http( - `https://arbitrum-sepolia.blockpi.network/v1/rpc/${process.env.BLOCKPI_API_KEY_ARB_SEPOLIA}` + `https://arb-sepolia.g.alchemy.com/v2/${process.env.ALCHEMY_API_KEY}`, + { + retryCount: 0, + } ), ]), ...pollingConfig,