Browse Source

Clean up

pull/886/head
Thomas 3 years ago
parent
commit
36df54bcc3
  1. 7
      apps/api/src/app/app.module.ts
  2. 1
      apps/api/src/services/cron.service.ts
  3. 9
      apps/api/src/services/data-gathering.service.ts

7
apps/api/src/app/app.module.ts

@ -37,7 +37,12 @@ import { UserModule } from './user/user.module';
AccountModule, AccountModule,
AuthDeviceModule, AuthDeviceModule,
AuthModule, AuthModule,
BullModule.forRoot({}), BullModule.forRoot({
redis: {
host: process.env.REDIS_HOST,
port: parseInt(process.env.REDIS_PORT, 10)
}
}),
CacheModule, CacheModule,
ConfigModule.forRoot(), ConfigModule.forRoot(),
ConfigurationModule, ConfigurationModule,

1
apps/api/src/services/cron.service.ts

@ -39,6 +39,7 @@ export class CronService {
@Cron(CronExpression.EVERY_WEEKEND) @Cron(CronExpression.EVERY_WEEKEND)
public async runEveryWeekend() { public async runEveryWeekend() {
const uniqueAssets = await this.dataGatheringService.getUniqueAssets(); const uniqueAssets = await this.dataGatheringService.getUniqueAssets();
for (const { dataSource, symbol } of uniqueAssets) { for (const { dataSource, symbol } of uniqueAssets) {
await this.dataGatheringQueue.add(GATHER_ASSET_PROFILE_PROCESS, { await this.dataGatheringQueue.add(GATHER_ASSET_PROFILE_PROCESS, {
dataSource, dataSource,

9
apps/api/src/services/data-gathering.service.ts

@ -227,8 +227,6 @@ export class DataGatheringService {
} }
public async gatherAssetProfiles(aUniqueAssets?: UniqueAsset[]) { public async gatherAssetProfiles(aUniqueAssets?: UniqueAsset[]) {
console.time('data-gathering-asset-profile');
let uniqueAssets = aUniqueAssets?.filter((dataGatheringItem) => { let uniqueAssets = aUniqueAssets?.filter((dataGatheringItem) => {
return dataGatheringItem.dataSource !== 'MANUAL'; return dataGatheringItem.dataSource !== 'MANUAL';
}); });
@ -325,10 +323,13 @@ export class DataGatheringService {
} }
Logger.log( 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' 'DataGatheringService'
); );
console.timeEnd('data-gathering-asset-profile');
} }
public async gatherSymbols(aSymbolsWithStartDate: IDataGatheringItem[]) { public async gatherSymbols(aSymbolsWithStartDate: IDataGatheringItem[]) {

Loading…
Cancel
Save