From 11f5805f30ef18e7c1e45911ece6dbe34cac0ddc Mon Sep 17 00:00:00 2001 From: Ivan S Date: Mon, 18 Nov 2024 10:23:23 +0800 Subject: [PATCH] attempts checker for blocks tasks --- main/src/modules/BlockProcessor/service.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main/src/modules/BlockProcessor/service.ts b/main/src/modules/BlockProcessor/service.ts index 66345e79..6b64279c 100644 --- a/main/src/modules/BlockProcessor/service.ts +++ b/main/src/modules/BlockProcessor/service.ts @@ -36,7 +36,17 @@ export class BlocksProcessorService { trx: Knex.Transaction, taskRecord: ProcessingTaskModel, ): Promise<{ status: boolean; callback?: any }> { - const { entity_id: blockId, collect_uid } = taskRecord + const { entity_id: blockId, collect_uid, attempts } = taskRecord + + if (attempts > 10) { + this.logger.info({ + event: 'BlockProcessor.processTaskMessage', + blockId, + message: `Block ${blockId} processing attempts > 10. Skip this block.`, + }) + + return { status: true } + } //check that block wasn't processed already if (await this.databaseHelper.getBlockById(blockId)) {