From 36df54bcc3b4cf2d032ff1342e84782b1eac5f52 Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Sat, 7 May 2022 19:35:33 +0200 Subject: [PATCH] Clean up --- apps/api/src/app/app.module.ts | 7 ++++++- apps/api/src/services/cron.service.ts | 1 + apps/api/src/services/data-gathering.service.ts | 9 +++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/api/src/app/app.module.ts b/apps/api/src/app/app.module.ts index 2d3b63e1b..f3b85fc9b 100644 --- a/apps/api/src/app/app.module.ts +++ b/apps/api/src/app/app.module.ts @@ -37,7 +37,12 @@ import { UserModule } from './user/user.module'; AccountModule, AuthDeviceModule, AuthModule, - BullModule.forRoot({}), + BullModule.forRoot({ + redis: { + host: process.env.REDIS_HOST, + port: parseInt(process.env.REDIS_PORT, 10) + } + }), CacheModule, ConfigModule.forRoot(), ConfigurationModule, diff --git a/apps/api/src/services/cron.service.ts b/apps/api/src/services/cron.service.ts index 90a806c47..40051b9ce 100644 --- a/apps/api/src/services/cron.service.ts +++ b/apps/api/src/services/cron.service.ts @@ -39,6 +39,7 @@ export class CronService { @Cron(CronExpression.EVERY_WEEKEND) public async runEveryWeekend() { const uniqueAssets = await this.dataGatheringService.getUniqueAssets(); + for (const { dataSource, symbol } of uniqueAssets) { await this.dataGatheringQueue.add(GATHER_ASSET_PROFILE_PROCESS, { dataSource, diff --git a/apps/api/src/services/data-gathering.service.ts b/apps/api/src/services/data-gathering.service.ts index 65dd71086..61adaa19e 100644 --- a/apps/api/src/services/data-gathering.service.ts +++ b/apps/api/src/services/data-gathering.service.ts @@ -227,8 +227,6 @@ export class DataGatheringService { } public async gatherAssetProfiles(aUniqueAssets?: UniqueAsset[]) { - console.time('data-gathering-asset-profile'); - let uniqueAssets = aUniqueAssets?.filter((dataGatheringItem) => { return dataGatheringItem.dataSource !== 'MANUAL'; }); @@ -325,10 +323,13 @@ export class DataGatheringService { } Logger.log( - 'Asset profile data gathering has been completed.', + `Asset profile data gathering has been completed for ${uniqueAssets + .map(({ dataSource, symbol }) => { + return `${symbol} (${dataSource})`; + }) + .join(',')}.`, 'DataGatheringService' ); - console.timeEnd('data-gathering-asset-profile'); } public async gatherSymbols(aSymbolsWithStartDate: IDataGatheringItem[]) {