Feature/extract common CACHE_TTL as constants (#3722)

Extract CACHE_TTL

* CACHE_TTL_NO_CACHE
* CACHE_TTL_INFINITE
pull/3737/head
Thomas Kaul 4 months ago committed by GitHub
parent fb44933c9c
commit df5e2f5f0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -7,7 +7,10 @@ import { MarketDataService } from '@ghostfolio/api/services/market-data/market-d
import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service';
import { PropertyService } from '@ghostfolio/api/services/property/property.service';
import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service';
import { PROPERTY_BENCHMARKS } from '@ghostfolio/common/config';
import {
CACHE_TTL_INFINITE,
PROPERTY_BENCHMARKS
} from '@ghostfolio/common/config';
import {
DATE_FORMAT,
calculateBenchmarkTrend,
@ -443,7 +446,7 @@ export class BenchmarkService {
benchmarks,
expiration: expiration.getTime()
}),
0
CACHE_TTL_INFINITE
);
}

@ -11,6 +11,7 @@ import { ConfigurationService } from '@ghostfolio/api/services/configuration/con
import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service';
import { IDataGatheringItem } from '@ghostfolio/api/services/interfaces/interfaces';
import { getIntervalFromDateRange } from '@ghostfolio/common/calculation-helper';
import { CACHE_TTL_INFINITE } from '@ghostfolio/common/config';
import {
DATE_FORMAT,
getSum,
@ -882,7 +883,7 @@ export abstract class PortfolioCalculator {
expiration: expiration.getTime(),
portfolioSnapshot: snapshot
})),
0
CACHE_TTL_INFINITE
);
return snapshot;

@ -1,5 +1,8 @@
import { Environment } from '@ghostfolio/api/services/interfaces/environment.interface';
import { DEFAULT_ROOT_URL } from '@ghostfolio/common/config';
import {
CACHE_TTL_NO_CACHE,
DEFAULT_ROOT_URL
} from '@ghostfolio/common/config';
import { Injectable } from '@nestjs/common';
import { DataSource } from '@prisma/client';
@ -22,7 +25,7 @@ export class ConfigurationService {
API_KEY_OPEN_FIGI: str({ default: '' }),
API_KEY_RAPID_API: str({ default: '' }),
CACHE_QUOTES_TTL: num({ default: ms('1 minute') }),
CACHE_TTL: num({ default: 1 }),
CACHE_TTL: num({ default: CACHE_TTL_NO_CACHE }),
DATA_SOURCE_EXCHANGE_RATES: str({ default: DataSource.YAHOO }),
DATA_SOURCE_IMPORT: str({ default: DataSource.YAHOO }),
DATA_SOURCES: json({

@ -30,6 +30,9 @@ export const warnColorRgb = {
b: 69
};
export const CACHE_TTL_NO_CACHE = 1;
export const CACHE_TTL_INFINITE = 0;
export const DATA_GATHERING_QUEUE = 'DATA_GATHERING_QUEUE';
export const DATA_GATHERING_QUEUE_PRIORITY_HIGH = 1;
export const DATA_GATHERING_QUEUE_PRIORITY_LOW = Number.MAX_SAFE_INTEGER;

Loading…
Cancel
Save