ghostfolio/apps/api/src/app/app.controller.ts

27 lines
766 B
TypeScript
Raw Normal View History

import { DataGatheringService } from '@ghostfolio/api/services/data-gathering.service';
2021-04-13 21:53:58 +02:00
import { Controller } from '@nestjs/common';
import { RedisCacheService } from './redis-cache/redis-cache.service';
@Controller()
export class AppController {
public constructor(
private readonly dataGatheringService: DataGatheringService,
2021-04-13 21:53:58 +02:00
private readonly redisCacheService: RedisCacheService
) {
this.initialize();
}
private async initialize() {
this.redisCacheService.reset();
const isDataGatheringInProgress =
await this.dataGatheringService.getIsInProgress();
2021-04-13 21:53:58 +02:00
if (isDataGatheringInProgress) {
// Prepare for automatical data gathering, if hung up in progress state
await this.dataGatheringService.reset();
2021-04-13 21:53:58 +02:00
}
}
}