diff --git a/apps/api/src/services/market-data/market-data.service.ts b/apps/api/src/services/market-data/market-data.service.ts index d09cab6c5..ea15fc9cd 100644 --- a/apps/api/src/services/market-data/market-data.service.ts +++ b/apps/api/src/services/market-data/market-data.service.ts @@ -221,7 +221,6 @@ export class MarketDataService { data: Prisma.MarketDataUpdateInput[]; }): Promise { await this.prismaService.$transaction(async (prisma) => { - // First, delete all existing market data for this symbol await prisma.marketData.deleteMany({ where: { dataSource, @@ -229,7 +228,6 @@ export class MarketDataService { } }); - // Then, insert all new market data const upsertPromises = data.map( ({ dataSource, date, marketPrice, state }) => { return prisma.marketData.create({ diff --git a/apps/api/src/services/queues/data-gathering/data-gathering.processor.ts b/apps/api/src/services/queues/data-gathering/data-gathering.processor.ts index 153316ea6..57c99a87c 100644 --- a/apps/api/src/services/queues/data-gathering/data-gathering.processor.ts +++ b/apps/api/src/services/queues/data-gathering/data-gathering.processor.ts @@ -157,8 +157,6 @@ export class DataGatheringProcessor { currentDate = addDays(currentDate, 1); } - // If replaceExistingData is true, use atomic replace to prevent data loss - // on failure. Otherwise, use the normal upsert approach. if (replaceExistingData) { await this.marketDataService.replaceAllForSymbol({ 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 0b8ed8931..7bcde097c 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 @@ -105,8 +105,6 @@ export class DataGatheringService { date: date ?? item.date })); - // Add a flag to indicate this should replace all existing data - // The data will be deleted and replaced within a transaction in the processor await this.gatherSymbols({ dataGatheringItems, priority: DATA_GATHERING_QUEUE_PRIORITY_HIGH,