From 202f61700e010d17a9cae5881674c054b1820e8a Mon Sep 17 00:00:00 2001 From: jerryfan01234 <44346807+jerryfan01234@users.noreply.github.com> Date: Tue, 1 Oct 2024 17:28:02 -0400 Subject: [PATCH] [OTE-846] Bazooka sequential clear (#2423) (cherry picked from commit b57eb4cc302459a81f64905d217525d17897a70f) --- indexer/services/bazooka/src/index.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/indexer/services/bazooka/src/index.ts b/indexer/services/bazooka/src/index.ts index 5aed0c2f9a..54902c8f39 100644 --- a/indexer/services/bazooka/src/index.ts +++ b/indexer/services/bazooka/src/index.ts @@ -265,14 +265,17 @@ async function partitionKafkaTopics(): Promise { async function clearKafkaTopics( existingKafkaTopics: string[], ): Promise { - await Promise.all( - _.map(KAFKA_TOPICS, - clearKafkaTopic.bind(null, - 1, - config.CLEAR_KAFKA_TOPIC_RETRY_MS, - config.CLEAR_KAFKA_TOPIC_MAX_RETRIES, - existingKafkaTopics)), - ); + // Concurrent calls to clear all topics caused the failure: + // TypeError: Cannot destructure property 'partitions' of 'high.pop(...)' as it is undefined. + for (const topic of KAFKA_TOPICS) { + await clearKafkaTopic( + 1, + config.CLEAR_KAFKA_TOPIC_RETRY_MS, + config.CLEAR_KAFKA_TOPIC_MAX_RETRIES, + existingKafkaTopics, + topic, + ); + } } export async function clearKafkaTopic(