From be1d1a55b3e0d5a05f6e35defd938c491629b83e Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Tue, 25 Aug 2026 10:16:46 +0200 Subject: [PATCH] Fix data gathering blocked by failed jobs --- apps/api/src/app/admin/admin.controller.ts | 5 +++++ .../data-gathering/data-gathering.service.ts | 14 ++++++++++++++ libs/common/src/lib/config.ts | 8 ++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/apps/api/src/app/admin/admin.controller.ts b/apps/api/src/app/admin/admin.controller.ts index ade8781d6..7ee99bf41 100644 --- a/apps/api/src/app/admin/admin.controller.ts +++ b/apps/api/src/app/admin/admin.controller.ts @@ -158,6 +158,11 @@ export class AdminController { @Param('dataSource') dataSource: DataSource, @Param('symbol') symbol: string ): Promise { + await this.dataGatheringService.removeAssetProfileJobFromQueue({ + dataSource, + symbol + }); + await this.dataGatheringService.addJobToQueue({ data: { dataSource, diff --git a/apps/api/src/services/queues/data-gathering/data-gathering.service.ts b/apps/api/src/services/queues/data-gathering/data-gathering.service.ts index 531f36f0d..aead0f81e 100644 --- a/apps/api/src/services/queues/data-gathering/data-gathering.service.ts +++ b/apps/api/src/services/queues/data-gathering/data-gathering.service.ts @@ -421,6 +421,20 @@ export class DataGatheringService { }); } + /** + * Removes the asset profile job of a symbol from the queue + */ + public async removeAssetProfileJobFromQueue({ + dataSource, + symbol + }: AssetProfileIdentifier) { + const job = await this.dataGatheringQueue.getJob( + `${getAssetProfileIdentifier({ dataSource, symbol })}:${dataSource}` + ); + + return job?.remove(); + } + private async getAssetProfileIdentifiersWithRecentMarketData(): Promise< AssetProfileIdentifier[] > { diff --git a/libs/common/src/lib/config.ts b/libs/common/src/lib/config.ts index 04186cfa9..7ed8de549 100644 --- a/libs/common/src/lib/config.ts +++ b/libs/common/src/lib/config.ts @@ -200,7 +200,9 @@ export const GATHER_ASSET_PROFILE_PROCESS_JOB_OPTIONS: JobOptions = { delay: ms('1 minute'), type: 'exponential' }, - removeOnComplete: true + removeOnComplete: true, + removeOnFail: true, + timeout: ms('5 minutes') }; export const GATHER_HISTORICAL_MARKET_DATA_COOLDOWN_IN_MS = ms('12 hours'); @@ -212,7 +214,9 @@ export const GATHER_HISTORICAL_MARKET_DATA_PROCESS_JOB_OPTIONS: JobOptions = { delay: ms('1 minute'), type: 'exponential' }, - removeOnComplete: true + removeOnComplete: true, + removeOnFail: true, + timeout: ms('5 minutes') }; export const GATHER_STATISTICS_PROCESS_JOB_OPTIONS: JobOptions = {