/// // Retention for the client_logs diagnostics (feedback 2 §4). These are for // live debugging, not an archive — trim anything older than 14 days daily so // the collection can't grow unbounded. Runs in PocketBase's cron scheduler. cronAdd("trimClientLogs", "0 4 * * *", () => { try { const cutoff = new Date(Date.now() - 14 * 24 * 60 * 60 * 1000) .toISOString().replace("T", " ").slice(0, 19) + ".000Z" const stale = $app.findRecordsByFilter( "client_logs", "created < {:c}", "created", 500, 0, { c: cutoff }) for (const r of stale) $app.delete(r) } catch (_) { /* nothing to trim / collection absent */ } })