From 569be7760a3c43f06f8f87c0aef88703c0b44fa7 Mon Sep 17 00:00:00 2001 From: Paul <108695806+pxrl@users.noreply.github.com> Date: Thu, 16 May 2024 20:25:54 +0200 Subject: [PATCH] improve(indexer): More debug logging In pursuit of a transient error in production. It may be related to 5xx errors on the WebSocketProvider. --- src/libexec/RelayerSpokePoolIndexer.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/libexec/RelayerSpokePoolIndexer.ts b/src/libexec/RelayerSpokePoolIndexer.ts index 10f25db00..14cb34871 100644 --- a/src/libexec/RelayerSpokePoolIndexer.ts +++ b/src/libexec/RelayerSpokePoolIndexer.ts @@ -286,6 +286,20 @@ async function run(argv: string[]): Promise { try { providers = getWSProviders(chainId, quorum); assert(providers.length > 0, `Insufficient providers for ${chain} (required ${quorum} by quorum)`); + providers.forEach((provider) => { + provider.on("error", (err) => + logger.debug({ at: "RelayerSpokePoolIndexer::run", message: `Caught ${chain} provider error.`, err }) + ); + + provider.on("close", () => { + logger.debug({ + at: "RelayerSpokePoolIndexer::run", + message: `${chain} provider connection closed.`, + provider: getOriginFromURL(provider.connection.url), + }); + }); + }); + logger.debug({ at: "RelayerSpokePoolIndexer::run", message: `Starting ${chain} listener.`, events, opts }); await listen(eventMgr, spokePool, events, providers, opts); } catch (err) {