From 522ed2ba81e15a05be340848c724d6052675338a Mon Sep 17 00:00:00 2001 From: CL TheDreWen Date: Fri, 31 Oct 2025 10:04:06 +0100 Subject: [PATCH] feat(status): implement log cleanup and enhance status fetching in StatusService --- src/services/status.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/services/status.service.ts b/src/services/status.service.ts index 83961aa..79839d1 100644 --- a/src/services/status.service.ts +++ b/src/services/status.service.ts @@ -104,9 +104,9 @@ export class StatusService { }, 3000); const cronJob = new cron.CronJob('*/2 * * * *', async () => { + // ? cleanup logs const oneMonthAgo = new Date(); oneMonthAgo.setMonth(oneMonthAgo.getMonth() - 1); - this.hostsLogRepo. createQueryBuilder() .delete() @@ -114,6 +114,7 @@ export class StatusService { .where("created_at < :date", { date: oneMonthAgo }) .execute(); + // ? Get status try { await this.fetch(); await this.updateClientStatus(); @@ -166,7 +167,7 @@ export class StatusService { const log = new HostsLog(); log.host = host.host; log.status = host.alive; - + this.hostsLogRepo.save(log); }