From a25e3d10119357e76b97b4803bbbb36dbcba3b22 Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Sun, 23 Mar 2025 13:09:50 +0000 Subject: [PATCH] Use interval --- .../src/integrations/telemetry/telemetry.service.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/server/src/integrations/telemetry/telemetry.service.ts b/apps/server/src/integrations/telemetry/telemetry.service.ts index 7e351589..99473e9d 100644 --- a/apps/server/src/integrations/telemetry/telemetry.service.ts +++ b/apps/server/src/integrations/telemetry/telemetry.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { Cron, CronExpression, SchedulerRegistry } from '@nestjs/schedule'; +import { Interval, SchedulerRegistry } from '@nestjs/schedule'; import { EnvironmentService } from '../environment/environment.service'; import { InjectKysely } from 'nestjs-kysely'; import { KyselyDB } from '@docmost/db/types/kysely.types'; @@ -19,9 +19,7 @@ export class TelemetryService { private schedulerRegistry: SchedulerRegistry, ) {} - @Cron(CronExpression.EVERY_DAY_AT_MIDNIGHT, { - name: 'telemetry', - }) + @Interval('telemetry', 24 * 60 * 60 * 1000) async sendTelemetry() { try { if ( @@ -29,7 +27,7 @@ export class TelemetryService { this.environmentService.isCloud() || this.environmentService.getNodeEnv() !== 'production' ) { - this.schedulerRegistry.deleteCronJob('telemetry'); + this.schedulerRegistry.deleteInterval('telemetry'); return; }