Browse Source

Refactoring

pull/5858/head
Thomas Kaul 3 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({
data,
dataSource,
symbol,
data
symbol
}: AssetProfileIdentifier & { data: Prisma.MarketDataUpdateInput[] }) {
/**
* 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) {
await this.marketDataService.replaceAllForSymbol({
data,
dataSource,
symbol,
data
symbol
});
} else {
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({
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({
dataGatheringItems,
priority,
force = false
force = false,
priority
}: {
dataGatheringItems: DataGatheringItem[];
priority: number;
force?: boolean;
priority: number;
}) {
await this.addJobsToQueue(
dataGatheringItems.map(({ dataSource, date, symbol }) => {
@ -284,8 +284,8 @@ export class DataGatheringService {
data: {
dataSource,
date,
symbol,
force
force,
symbol
},
name: GATHER_HISTORICAL_MARKET_DATA_PROCESS_JOB_NAME,
opts: {

Loading…
Cancel
Save