Use logsDb for the status history

This commit is contained in:
Owen
2026-04-28 16:38:13 -07:00
parent 85415176ab
commit 2a29062659
6 changed files with 67 additions and 38 deletions

View File

@@ -13,7 +13,13 @@
import logger from "@server/logger";
import { processAlerts } from "../processAlerts";
import { db, sites, statusHistory, targetHealthCheck, Transaction } from "@server/db";
import {
db,
logsDb,
statusHistory,
targetHealthCheck,
Transaction
} from "@server/db";
import { invalidateStatusHistoryCache } from "@server/lib/statusHistory";
import { and, eq, inArray } from "drizzle-orm";
import { fireHealthCheckUnhealthyAlert } from "./healthCheckEvents";
@@ -41,7 +47,7 @@ export async function fireSiteOnlineAlert(
trx: Transaction | typeof db = db
): Promise<void> {
try {
await trx.insert(statusHistory).values({
await logsDb.insert(statusHistory).values({
entityType: "site",
entityId: siteId,
orgId: orgId,
@@ -97,7 +103,7 @@ export async function fireSiteOfflineAlert(
trx: Transaction | typeof db = db
): Promise<void> {
try {
await trx.insert(statusHistory).values({
await logsDb.insert(statusHistory).values({
entityType: "site",
entityId: siteId,
orgId: orgId,