diff --git a/CHANGELOG.md b/CHANGELOG.md index 23fcb46de..b67cd0f3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improved the usability to customize the rule thresholds in the _X-ray_ section by introducing units (experimental) - Improved the language localization for German (`de`) +### Fixed + +- Fixed the usage of the environment variable `PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_CONCURRENCY` + ## 2.115.0 - 2024-10-14 ### Added diff --git a/apps/api/src/app/admin/queue/queue.service.ts b/apps/api/src/app/admin/queue/queue.service.ts index 7e4f0adb7..b0058e81f 100644 --- a/apps/api/src/app/admin/queue/queue.service.ts +++ b/apps/api/src/app/admin/queue/queue.service.ts @@ -1,6 +1,6 @@ import { DATA_GATHERING_QUEUE, - PORTFOLIO_SNAPSHOT_QUEUE, + PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE, QUEUE_JOB_STATUS_LIST } from '@ghostfolio/common/config'; import { AdminJobs } from '@ghostfolio/common/interfaces'; @@ -14,7 +14,7 @@ export class QueueService { public constructor( @InjectQueue(DATA_GATHERING_QUEUE) private readonly dataGatheringQueue: Queue, - @InjectQueue(PORTFOLIO_SNAPSHOT_QUEUE) + @InjectQueue(PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE) private readonly portfolioSnapshotQueue: Queue ) {} diff --git a/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts b/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts index 3d39b80b5..dec0e6387 100644 --- a/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts +++ b/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts @@ -15,8 +15,8 @@ import { getIntervalFromDateRange } from '@ghostfolio/common/calculation-helper' import { PORTFOLIO_SNAPSHOT_PROCESS_JOB_NAME, PORTFOLIO_SNAPSHOT_PROCESS_JOB_OPTIONS, - PORTFOLIO_SNAPSHOT_QUEUE_PRIORITY_HIGH, - PORTFOLIO_SNAPSHOT_QUEUE_PRIORITY_LOW + PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE_PRIORITY_HIGH, + PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE_PRIORITY_LOW } from '@ghostfolio/common/config'; import { DATE_FORMAT, @@ -1080,7 +1080,7 @@ export abstract class PortfolioCalculator { opts: { ...PORTFOLIO_SNAPSHOT_PROCESS_JOB_OPTIONS, jobId, - priority: PORTFOLIO_SNAPSHOT_QUEUE_PRIORITY_LOW + priority: PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE_PRIORITY_LOW } }); } @@ -1096,7 +1096,7 @@ export abstract class PortfolioCalculator { opts: { ...PORTFOLIO_SNAPSHOT_PROCESS_JOB_OPTIONS, jobId, - priority: PORTFOLIO_SNAPSHOT_QUEUE_PRIORITY_HIGH + priority: PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE_PRIORITY_HIGH } }); diff --git a/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.module.ts b/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.module.ts index 058d971d8..958636334 100644 --- a/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.module.ts +++ b/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.module.ts @@ -10,7 +10,7 @@ import { MarketDataModule } from '@ghostfolio/api/services/market-data/market-da import { PortfolioSnapshotService } from '@ghostfolio/api/services/queues/portfolio-snapshot/portfolio-snapshot.service'; import { DEFAULT_PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_TIMEOUT, - PORTFOLIO_SNAPSHOT_QUEUE + PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE } from '@ghostfolio/common/config'; import { BullModule } from '@nestjs/bull'; @@ -23,7 +23,7 @@ import { PortfolioSnapshotProcessor } from './portfolio-snapshot.processor'; imports: [ AccountBalanceModule, BullModule.registerQueue({ - name: PORTFOLIO_SNAPSHOT_QUEUE, + name: PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE, settings: { lockDuration: parseInt( process.env.PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_TIMEOUT ?? diff --git a/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.processor.ts b/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.processor.ts index c66ef2a4c..c586a51b3 100644 --- a/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.processor.ts +++ b/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.processor.ts @@ -11,7 +11,7 @@ import { CACHE_TTL_INFINITE, DEFAULT_PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_CONCURRENCY, PORTFOLIO_SNAPSHOT_PROCESS_JOB_NAME, - PORTFOLIO_SNAPSHOT_QUEUE + PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE } from '@ghostfolio/common/config'; import { Process, Processor } from '@nestjs/bull'; @@ -22,7 +22,7 @@ import { addMilliseconds } from 'date-fns'; import { IPortfolioSnapshotQueueJob } from './interfaces/portfolio-snapshot-queue-job.interface'; @Injectable() -@Processor(PORTFOLIO_SNAPSHOT_QUEUE) +@Processor(PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE) export class PortfolioSnapshotProcessor { public constructor( private readonly accountBalanceService: AccountBalanceService, @@ -34,7 +34,7 @@ export class PortfolioSnapshotProcessor { @Process({ concurrency: parseInt( - process.env.PROCESSOR_CONCURRENCY_PORTFOLIO_SNAPSHOT ?? + process.env.PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_CONCURRENCY ?? DEFAULT_PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_CONCURRENCY.toString(), 10 ), diff --git a/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.service.ts b/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.service.ts index 27ebdee53..9dba9275e 100644 --- a/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.service.ts +++ b/apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.service.ts @@ -1,4 +1,4 @@ -import { PORTFOLIO_SNAPSHOT_QUEUE } from '@ghostfolio/common/config'; +import { PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE } from '@ghostfolio/common/config'; import { InjectQueue } from '@nestjs/bull'; import { Injectable } from '@nestjs/common'; @@ -9,7 +9,7 @@ import { IPortfolioSnapshotQueueJob } from './interfaces/portfolio-snapshot-queu @Injectable() export class PortfolioSnapshotService { public constructor( - @InjectQueue(PORTFOLIO_SNAPSHOT_QUEUE) + @InjectQueue(PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE) private readonly portfolioSnapshotQueue: Queue ) {} diff --git a/libs/common/src/lib/config.ts b/libs/common/src/lib/config.ts index 87b348b26..4580ef4df 100644 --- a/libs/common/src/lib/config.ts +++ b/libs/common/src/lib/config.ts @@ -40,9 +40,11 @@ export const DATA_GATHERING_QUEUE_PRIORITY_MEDIUM = Math.round( DATA_GATHERING_QUEUE_PRIORITY_LOW / 2 ); -export const PORTFOLIO_SNAPSHOT_QUEUE = 'PORTFOLIO_SNAPSHOT_QUEUE'; -export const PORTFOLIO_SNAPSHOT_QUEUE_PRIORITY_HIGH = 1; -export const PORTFOLIO_SNAPSHOT_QUEUE_PRIORITY_LOW = Number.MAX_SAFE_INTEGER; +export const PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE = + 'PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE'; +export const PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE_PRIORITY_HIGH = 1; +export const PORTFOLIO_SNAPSHOT_COMPUTATION_QUEUE_PRIORITY_LOW = + Number.MAX_SAFE_INTEGER; export const DEFAULT_CURRENCY = 'USD'; export const DEFAULT_DATE_FORMAT_MONTH_YEAR = 'MMM yyyy';