From 356b42d1c0b193b20d6f18a112f4cab5d94ee67d Mon Sep 17 00:00:00 2001 From: perfogic Date: Fri, 4 Oct 2024 02:23:51 +0700 Subject: [PATCH] add submit relay checkpoint interval delay --- packages/orchestrator/src/constants.ts | 1 + packages/orchestrator/src/services/relayer/index.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/packages/orchestrator/src/constants.ts b/packages/orchestrator/src/constants.ts index 3717b8d..88d4a5c 100644 --- a/packages/orchestrator/src/constants.ts +++ b/packages/orchestrator/src/constants.ts @@ -2,6 +2,7 @@ export const RELAY_HEADER_BATCH_SIZE = 250; export const SCAN_MEMPOOL_CHUNK_SIZE = 1000; export const SCAN_MEMPOOL_CHUNK_INTERVAL_DELAY = 100; export const SCAN_BLOCK_TXS_INTERVAL_DELAY = 100; +export const SUBMIT_RELAY_CHECKPOINT_INTERVAL_DELAY = 100; export const RELAY_DEPOSIT_BLOCKS_SIZE = 200; // 10 blocks export const RETRY_DELAY = 1000; // 1 second export const ITERATION_DELAY = { diff --git a/packages/orchestrator/src/services/relayer/index.ts b/packages/orchestrator/src/services/relayer/index.ts index aed6277..80c96ba 100644 --- a/packages/orchestrator/src/services/relayer/index.ts +++ b/packages/orchestrator/src/services/relayer/index.ts @@ -40,6 +40,7 @@ import { SCAN_BLOCK_TXS_INTERVAL_DELAY, SCAN_MEMPOOL_CHUNK_INTERVAL_DELAY, SCAN_MEMPOOL_CHUNK_SIZE, + SUBMIT_RELAY_CHECKPOINT_INTERVAL_DELAY, } from "../../constants"; import { chunkArray } from "../../utils/array"; import { @@ -585,6 +586,8 @@ class RelayerService implements RelayerInterface { relayed[checkpoint] = true; console.log(`Relayed checkpoint tx ${tx}`); } catch (err) {} + + await setTimeout(SUBMIT_RELAY_CHECKPOINT_INTERVAL_DELAY); } } catch (err) { this.logger.error(`[RELAY_CHECKPOINT] ${err?.message}`);