diff --git a/src/task/task.service.ts b/src/task/task.service.ts index b1221e60..aca9af0f 100644 --- a/src/task/task.service.ts +++ b/src/task/task.service.ts @@ -10,7 +10,9 @@ export class TasksService { constructor( private configService: ConfigService, private graphqlSvc: GraphqlService, - ) {} + ) { + this.getViewsReport(); + } // every minute, on the 1st second @Cron('1 * * * * *') @@ -72,7 +74,9 @@ export class TasksService { const response = await this.runReport(); const env = this.configService.get('app.env'); - const subdomain_pattern = env !== '' ? `${env}\.` : ''; + const subdomain_pattern = ['dev', 'staging'].includes(env) + ? `${env}\.` + : ''; const regex = new RegExp( `https://${subdomain_pattern}punkga\.me(\/[A-Za-z]+)?\/comic\/[0-9]+\/chapter\/[0-9]+`,