Browse Source

Refactoring

pull/5858/head
Thomas Kaul 6 days ago
parent
commit
964879fedc
  1. 4
      apps/api/src/services/market-data/market-data.service.ts
  2. 4
      apps/api/src/services/queues/data-gathering/data-gathering.processor.ts
  3. 14
      apps/api/src/services/queues/data-gathering/data-gathering.service.ts

4
apps/api/src/services/market-data/market-data.service.ts

@ -207,9 +207,9 @@ export class MarketDataService {
} }
public async replaceAllForSymbol({ public async replaceAllForSymbol({
data,
dataSource, dataSource,
symbol, symbol
data
}: AssetProfileIdentifier & { data: Prisma.MarketDataUpdateInput[] }) { }: AssetProfileIdentifier & { data: Prisma.MarketDataUpdateInput[] }) {
/** /**
* Atomically replace all market data for a symbol. * Atomically replace all market data for a symbol.

4
apps/api/src/services/queues/data-gathering/data-gathering.processor.ts

@ -159,9 +159,9 @@ export class DataGatheringProcessor {
if (force) { if (force) {
await this.marketDataService.replaceAllForSymbol({ await this.marketDataService.replaceAllForSymbol({
data,
dataSource, dataSource,
symbol, symbol
data
}); });
} else { } else {
await this.marketDataService.updateMany({ data }); await this.marketDataService.updateMany({ data });

14
apps/api/src/services/queues/data-gathering/data-gathering.service.ts

@ -107,8 +107,8 @@ export class DataGatheringService {
await this.gatherSymbols({ await this.gatherSymbols({
dataGatheringItems, dataGatheringItems,
priority: DATA_GATHERING_QUEUE_PRIORITY_HIGH, force: true,
force: true priority: DATA_GATHERING_QUEUE_PRIORITY_HIGH
}); });
} }
@ -271,12 +271,12 @@ export class DataGatheringService {
public async gatherSymbols({ public async gatherSymbols({
dataGatheringItems, dataGatheringItems,
priority, force = false,
force = false priority
}: { }: {
dataGatheringItems: DataGatheringItem[]; dataGatheringItems: DataGatheringItem[];
priority: number;
force?: boolean; force?: boolean;
priority: number;
}) { }) {
await this.addJobsToQueue( await this.addJobsToQueue(
dataGatheringItems.map(({ dataSource, date, symbol }) => { dataGatheringItems.map(({ dataSource, date, symbol }) => {
@ -284,8 +284,8 @@ export class DataGatheringService {
data: { data: {
dataSource, dataSource,
date, date,
symbol, force,
force symbol
}, },
name: GATHER_HISTORICAL_MARKET_DATA_PROCESS_JOB_NAME, name: GATHER_HISTORICAL_MARKET_DATA_PROCESS_JOB_NAME,
opts: { opts: {

Loading…
Cancel
Save