fix: high cpu from status probes and full database saves on every sample (#1300)

This commit is contained in:
LukeGus committed 2026-10-03 15:37:11 -05:00
1 parent 11a22d30eb
commit 79bd10a1b0
10 files changed
+241 -22

No files matched your search

@@ -528,7 +528,7 @@ export async function createAutomationRepository(
.set({ lastRunAt: run[0].startedAt, lastRunStatus: input.status })
.where(eq(automations.id, run[0].automationId));
}
await db.persist();
await db.persist({ lazy: true });
},
async listRuns(
@@ -630,7 +630,7 @@ export async function createAutomationRepository(
.where(lt(runs.startedAt, cutoff));
if (old.length === 0) return 0;
await drizzle.delete(runs).where(lt(runs.startedAt, cutoff));
await db.persist();
await db.persist({ lazy: true });
return old.length;
},