From 4c39f0d59ac4123f4c407a3f040cdf5d93c455cc Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 19 Sep 2026 20:09:22 +0200 Subject: [PATCH] Extend portfolio snapshot cache key by performance calculation type --- .../src/app/portfolio/calculator/portfolio-calculator.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts b/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts index d478076f7c..ef6dca3db6 100644 --- a/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts +++ b/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts @@ -1208,9 +1208,11 @@ export abstract class PortfolioCalculator { let cachedPortfolioSnapshot: PortfolioSnapshot | undefined; let isCachedPortfolioSnapshotExpired = false; + const calculationType = this.getPerformanceCalculationType(); + const portfolioSnapshotKey = this.redisCacheService.getPortfolioSnapshotKey( { - calculationType: this.getPerformanceCalculationType(), + calculationType, filters: this.filters, userId: this.userId } @@ -1249,7 +1251,7 @@ export abstract class PortfolioCalculator { // Compute in the background this.portfolioSnapshotService.addJobToQueue({ data: { - calculationType: this.getPerformanceCalculationType(), + calculationType, filters: this.filters, userCurrency: this.currency, userId: this.userId @@ -1272,7 +1274,7 @@ export abstract class PortfolioCalculator { // Wait for computation await this.portfolioSnapshotService.addJobToQueue({ data: { - calculationType: this.getPerformanceCalculationType(), + calculationType, filters: this.filters, userCurrency: this.currency, userId: this.userId