mirror of
https://github.com/thedrewen/protojx-manager.git
synced 2026-03-23 05:01:54 +01:00
feat(status): implement log cleanup and enhance status fetching in StatusService
This commit is contained in:
@@ -104,9 +104,9 @@ export class StatusService {
|
|||||||
}, 3000);
|
}, 3000);
|
||||||
const cronJob = new cron.CronJob('*/2 * * * *', async () => {
|
const cronJob = new cron.CronJob('*/2 * * * *', async () => {
|
||||||
|
|
||||||
|
// ? cleanup logs
|
||||||
const oneMonthAgo = new Date();
|
const oneMonthAgo = new Date();
|
||||||
oneMonthAgo.setMonth(oneMonthAgo.getMonth() - 1);
|
oneMonthAgo.setMonth(oneMonthAgo.getMonth() - 1);
|
||||||
|
|
||||||
this.hostsLogRepo.
|
this.hostsLogRepo.
|
||||||
createQueryBuilder()
|
createQueryBuilder()
|
||||||
.delete()
|
.delete()
|
||||||
@@ -114,6 +114,7 @@ export class StatusService {
|
|||||||
.where("created_at < :date", { date: oneMonthAgo })
|
.where("created_at < :date", { date: oneMonthAgo })
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
|
// ? Get status
|
||||||
try {
|
try {
|
||||||
await this.fetch();
|
await this.fetch();
|
||||||
await this.updateClientStatus();
|
await this.updateClientStatus();
|
||||||
|
|||||||
Reference in New Issue
Block a user