Browse Source

Extend portfolio snapshot cache key by performance calculation type

pull/7913/head
Thomas Kaul 4 weeks ago
parent
commit
4c39f0d59a
  1. 8
      apps/api/src/app/portfolio/calculator/portfolio-calculator.ts

8
apps/api/src/app/portfolio/calculator/portfolio-calculator.ts

@ -1208,9 +1208,11 @@ export abstract class PortfolioCalculator {
let cachedPortfolioSnapshot: PortfolioSnapshot | undefined; let cachedPortfolioSnapshot: PortfolioSnapshot | undefined;
let isCachedPortfolioSnapshotExpired = false; let isCachedPortfolioSnapshotExpired = false;
const calculationType = this.getPerformanceCalculationType();
const portfolioSnapshotKey = this.redisCacheService.getPortfolioSnapshotKey( const portfolioSnapshotKey = this.redisCacheService.getPortfolioSnapshotKey(
{ {
calculationType: this.getPerformanceCalculationType(), calculationType,
filters: this.filters, filters: this.filters,
userId: this.userId userId: this.userId
} }
@ -1249,7 +1251,7 @@ export abstract class PortfolioCalculator {
// Compute in the background // Compute in the background
this.portfolioSnapshotService.addJobToQueue({ this.portfolioSnapshotService.addJobToQueue({
data: { data: {
calculationType: this.getPerformanceCalculationType(), calculationType,
filters: this.filters, filters: this.filters,
userCurrency: this.currency, userCurrency: this.currency,
userId: this.userId userId: this.userId
@ -1272,7 +1274,7 @@ export abstract class PortfolioCalculator {
// Wait for computation // Wait for computation
await this.portfolioSnapshotService.addJobToQueue({ await this.portfolioSnapshotService.addJobToQueue({
data: { data: {
calculationType: this.getPerformanceCalculationType(), calculationType,
filters: this.filters, filters: this.filters,
userCurrency: this.currency, userCurrency: this.currency,
userId: this.userId userId: this.userId

Loading…
Cancel
Save