mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Add retention policy for device_events and notifications
Purges records older than a configurable window (default 365d) once per day. Also adds a composite index on device_events(mac_address, created_on DESC) for efficient scan history queries at scale, and fixes a non-deterministic pagination order by adding id as a tiebreaker to ORDER BY. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
888f18603f
commit
c7e1678407
@@ -48,6 +48,19 @@ pub struct WebServer {
|
||||
pub api_key: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
pub struct Retention {
|
||||
pub window: DurationString,
|
||||
}
|
||||
|
||||
impl Default for Retention {
|
||||
fn default() -> Self {
|
||||
Retention {
|
||||
window: DurationString::try_from("365d".to_string()).unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
pub struct Settings {
|
||||
pub database: Database,
|
||||
@@ -56,6 +69,8 @@ pub struct Settings {
|
||||
pub timings: Timings,
|
||||
pub notifications: Notifications,
|
||||
pub web_server: WebServer,
|
||||
#[serde(default)]
|
||||
pub retention: Retention,
|
||||
}
|
||||
// End configuration structure
|
||||
// -----------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user