Browse Source
Feature/expose portfolio snapshot computation timeout as environment variable (#3894)
* Expose portfolio snapshot computation timeout as environment variable
* Update changelog
pull/3912/head^2
ceroma
3 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
18 additions and
2 deletions
-
CHANGELOG.md
-
apps/api/src/services/configuration/configuration.service.ts
-
apps/api/src/services/queues/portfolio-snapshot/portfolio-snapshot.module.ts
-
libs/common/src/lib/config.ts
|
|
@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
- Exposed the timeout of the portfolio snapshot computation as an environment variable (`PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_TIMEOUT`) |
|
|
|
- Improved the portfolio unit tests to work with exported activity files |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
@ -4,6 +4,7 @@ import { |
|
|
|
DEFAULT_PROCESSOR_CONCURRENCY_GATHER_ASSET_PROFILE, |
|
|
|
DEFAULT_PROCESSOR_CONCURRENCY_GATHER_HISTORICAL_MARKET_DATA, |
|
|
|
DEFAULT_PROCESSOR_CONCURRENCY_PORTFOLIO_SNAPSHOT, |
|
|
|
DEFAULT_PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_TIMEOUT, |
|
|
|
DEFAULT_ROOT_URL |
|
|
|
} from '@ghostfolio/common/config'; |
|
|
|
|
|
|
@ -59,6 +60,9 @@ export class ConfigurationService { |
|
|
|
PROCESSOR_CONCURRENCY_PORTFOLIO_SNAPSHOT: num({ |
|
|
|
default: DEFAULT_PROCESSOR_CONCURRENCY_PORTFOLIO_SNAPSHOT |
|
|
|
}), |
|
|
|
PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_TIMEOUT: num({ |
|
|
|
default: DEFAULT_PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_TIMEOUT |
|
|
|
}), |
|
|
|
REDIS_DB: num({ default: 0 }), |
|
|
|
REDIS_HOST: str({ default: 'localhost' }), |
|
|
|
REDIS_PASSWORD: str({ default: '' }), |
|
|
|
|
|
@ -8,7 +8,10 @@ import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data- |
|
|
|
import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.module'; |
|
|
|
import { MarketDataModule } from '@ghostfolio/api/services/market-data/market-data.module'; |
|
|
|
import { PortfolioSnapshotService } from '@ghostfolio/api/services/queues/portfolio-snapshot/portfolio-snapshot.service'; |
|
|
|
import { PORTFOLIO_SNAPSHOT_QUEUE } from '@ghostfolio/common/config'; |
|
|
|
import { |
|
|
|
DEFAULT_PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_TIMEOUT, |
|
|
|
PORTFOLIO_SNAPSHOT_QUEUE |
|
|
|
} from '@ghostfolio/common/config'; |
|
|
|
|
|
|
|
import { BullModule } from '@nestjs/bull'; |
|
|
|
import { Module } from '@nestjs/common'; |
|
|
@ -20,7 +23,14 @@ import { PortfolioSnapshotProcessor } from './portfolio-snapshot.processor'; |
|
|
|
imports: [ |
|
|
|
AccountBalanceModule, |
|
|
|
BullModule.registerQueue({ |
|
|
|
name: PORTFOLIO_SNAPSHOT_QUEUE |
|
|
|
name: PORTFOLIO_SNAPSHOT_QUEUE, |
|
|
|
settings: { |
|
|
|
lockDuration: parseInt( |
|
|
|
process.env.PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_TIMEOUT ?? |
|
|
|
DEFAULT_PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_TIMEOUT.toString(), |
|
|
|
10 |
|
|
|
) |
|
|
|
} |
|
|
|
}), |
|
|
|
ConfigurationModule, |
|
|
|
DataProviderModule, |
|
|
|
|
|
@ -51,6 +51,7 @@ export const DEFAULT_PAGE_SIZE = 50; |
|
|
|
export const DEFAULT_PROCESSOR_CONCURRENCY_GATHER_ASSET_PROFILE = 1; |
|
|
|
export const DEFAULT_PROCESSOR_CONCURRENCY_GATHER_HISTORICAL_MARKET_DATA = 1; |
|
|
|
export const DEFAULT_PROCESSOR_CONCURRENCY_PORTFOLIO_SNAPSHOT = 1; |
|
|
|
export const DEFAULT_PROCESSOR_PORTFOLIO_SNAPSHOT_COMPUTATION_TIMEOUT = 30000; |
|
|
|
export const DEFAULT_ROOT_URL = 'https://localhost:4200'; |
|
|
|
|
|
|
|
// USX is handled separately
|
|
|
|