mirror of
https://github.com/fosrl/pangolin.git
synced 2026-04-30 09:41:51 +00:00
Add caching to the hc and fix resource stuff
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
import logger from "@server/logger";
|
||||
import { processAlerts } from "../processAlerts";
|
||||
import { db, sites, statusHistory, targetHealthCheck, Transaction } from "@server/db";
|
||||
import { invalidateStatusHistoryCache } from "@server/lib/statusHistory";
|
||||
import { and, eq, inArray } from "drizzle-orm";
|
||||
import { fireHealthCheckUnhealthyAlert } from "./healthCheckEvents";
|
||||
|
||||
@@ -47,6 +48,7 @@ export async function fireSiteOnlineAlert(
|
||||
status: "online",
|
||||
timestamp: Math.floor(Date.now() / 1000)
|
||||
});
|
||||
await invalidateStatusHistoryCache("site", siteId);
|
||||
|
||||
await processAlerts({
|
||||
eventType: "site_online",
|
||||
@@ -102,6 +104,7 @@ export async function fireSiteOfflineAlert(
|
||||
status: "offline",
|
||||
timestamp: Math.floor(Date.now() / 1000)
|
||||
});
|
||||
await invalidateStatusHistoryCache("site", siteId);
|
||||
|
||||
const unhealthyHealthChecks = await trx
|
||||
.update(targetHealthCheck)
|
||||
|
||||
Reference in New Issue
Block a user