From 38528b2cd867f894268346711f4464802fc680fc Mon Sep 17 00:00:00 2001 From: Christopher-Li Date: Mon, 19 Aug 2024 14:42:38 -0400 Subject: [PATCH] Set fromBeginning to false by default (#2101) (#2107) --- indexer/services/vulcan/src/config.ts | 2 +- .../services/vulcan/src/helpers/kafka/kafka-controller.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/indexer/services/vulcan/src/config.ts b/indexer/services/vulcan/src/config.ts index cab0e73976..41fb3548cf 100644 --- a/indexer/services/vulcan/src/config.ts +++ b/indexer/services/vulcan/src/config.ts @@ -21,7 +21,7 @@ export const configSchema = { ...redisConfigSchema, BATCH_PROCESSING_ENABLED: parseBoolean({ default: true }), - PROCESS_FROM_BEGINNING: parseBoolean({ default: true }), + PROCESS_FROM_BEGINNING: parseBoolean({ default: false }), KAFKA_BATCH_PROCESSING_COMMIT_FREQUENCY_MS: parseNumber({ default: 3_000, }), diff --git a/indexer/services/vulcan/src/helpers/kafka/kafka-controller.ts b/indexer/services/vulcan/src/helpers/kafka/kafka-controller.ts index 5482d4bae4..ae2038f0f3 100644 --- a/indexer/services/vulcan/src/helpers/kafka/kafka-controller.ts +++ b/indexer/services/vulcan/src/helpers/kafka/kafka-controller.ts @@ -17,8 +17,11 @@ export async function connect(): Promise { await consumer.subscribe({ topic: KafkaTopics.TO_VULCAN, // https://kafka.js.org/docs/consuming#a-name-from-beginning-a-frombeginning - // Need to set fromBeginning to true, so when vulcan restarts, it will consume all messages - // rather than ignoring the messages in queue that were produced before ender was started. + // fromBeginning is by default set to false, so vulcan will only consume messages produced + // after vulcan was started. This config should almost never matter, because by Vulcan should + // read from the last read offset. fromBeginning will only matter if the offset is lost. + // In the case where the offset is lost, Vulcan should read from head because in 60 seconds all + // short term messages will expire and we can resend stateful orders through bazooka to Vulcan. fromBeginning: config.PROCESS_FROM_BEGINNING, });