diff --git a/rs/boundary_node/anonymization/backend/src/main.rs b/rs/boundary_node/anonymization/backend/src/main.rs index c54027c1ee8..c659c0b5bf5 100644 --- a/rs/boundary_node/anonymization/backend/src/main.rs +++ b/rs/boundary_node/anonymization/backend/src/main.rs @@ -252,6 +252,7 @@ thread_local! { // Timers const SECOND: Duration = Duration::from_secs(1); +const DAY: Duration = Duration::from_secs(24 * 60 * 60); fn timers() { // ACLs @@ -326,6 +327,31 @@ fn timers() { }); }); + // TTLs + set_timer_interval(7 * DAY, || { + // Remove all encrypted values + let ids = ENCRYPTED_VALUES.with(|vs| { + let mut vs = vs.borrow_mut(); + + let ids: Vec<_> = vs.iter().map(|(k, _)| k).collect(); + vs.clear_new(); + + ids + }); + + // Re-queue + QUEUE.with(|q| { + let mut q = q.borrow_mut(); + + for id in ids { + q.insert( + id, // principal + (), // unit + ); + } + }); + }); + // Leader set_timer_interval(30 * SECOND, || { // Collect candidates that have registered a public-key