Skip to content

Commit

Permalink
Merge pull request OneUptime#1680 from OneUptime/oneuptime-copilot-on…
Browse files Browse the repository at this point in the history
…euptime-copilot-improve-comments-lBIXQ

Improved comments on /App/FeatureSet/Workers/Jobs/MonitorMetrics/MonitorMetricsByMinute.ts
  • Loading branch information
simlarsen authored Sep 8, 2024
2 parents 9fbdc68 + da32393 commit cc1a4df
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import OneUptimeDate from "Common/Types/Date";
import { EVERY_MINUTE } from "Common/Utils/CronTime";
import MonitorMetricsByMinuteService from "Common/Server/Services/MonitorMetricsByMinuteService";

// Schedule a cron job to run every minute
RunCron(
"MonitorMetrics:HardDeleteMonitorMetricsByMinute",
{ schedule: EVERY_MINUTE, runOnStartup: false },
async () => {
// Calculate the timestamp for one hour ago
const oneHourAgo: Date = OneUptimeDate.getSomeMinutesAgo(60);

// Delete all monitor metrics older than one hour

await MonitorMetricsByMinuteService.deleteBy({
query: {
createdAt: new LessThan(oneHourAgo),
Expand Down

0 comments on commit cc1a4df

Please sign in to comment.