Feature: Multi-email alerts and move resource between groups
- notificationService: Parse comma-separated emails from resource.email_to or global config; validate and send to each recipient - API: Add PATCH /api/resources/:id/group endpoint to move resource between groups with validation and cache invalidation - UI: Add group selector to edit modal; wire group change to PATCH endpoint; add help text for multi-email format
This commit is contained in:
1 parent
9c1c972045
commit
923c36e494
12 files changed
+115
-12
No files matched your search
@@ -92,6 +92,29 @@ class Scheduler {
|
||||
const result = await monitorService.checkResource(resource);
|
||||
monitorService.saveCheck(result);
|
||||
|
||||
// Rolling cap per resource (configurable via settings; default 10000)
|
||||
try {
|
||||
const capSetting = db.prepare(`SELECT value FROM settings WHERE key = 'checks_cap_per_resource'`).get();
|
||||
const cap = capSetting ? parseInt(capSetting.value) : 10000;
|
||||
if (Number.isFinite(cap) && cap > 0) {
|
||||
// Delete oldest rows beyond cap, using id ordering per resource
|
||||
db.prepare(`
|
||||
DELETE FROM checks
|
||||
WHERE id IN (
|
||||
SELECT id FROM checks
|
||||
WHERE resource_id = ?
|
||||
ORDER BY id ASC
|
||||
LIMIT (
|
||||
SELECT MAX(COUNT(*) - ?, 0)
|
||||
FROM checks WHERE resource_id = ?
|
||||
)
|
||||
)
|
||||
`).run(resource.id, cap, resource.id);
|
||||
}
|
||||
} catch (e) {
|
||||
// Non-fatal
|
||||
}
|
||||
|
||||
const incident = monitorService.handleIncident(
|
||||
resource.id,
|
||||
result.status === 'down'
|
||||
|
||||
Reference in new issue
Block a user