From cb01427dcff14b3d88e30220695fc97978786a9a Mon Sep 17 00:00:00 2001 From: Nutomic Date: Mon, 6 Nov 2023 22:17:53 +0100 Subject: [PATCH] Only keep sent and received activities for 7 days (fixes #4113, fixes #4110) (#4131) --- src/scheduled_tasks.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/scheduled_tasks.rs b/src/scheduled_tasks.rs index 8db74ef9d..5c1cab3fa 100644 --- a/src/scheduled_tasks.rs +++ b/src/scheduled_tasks.rs @@ -295,14 +295,17 @@ async fn clear_old_activities(pool: &mut DbPool<'_>) { match conn { Ok(mut conn) => { - diesel::delete(sent_activity::table.filter(sent_activity::published.lt(now() - 3.months()))) - .execute(&mut conn) - .await - .map_err(|e| error!("Failed to clear old sent activities: {e}")) - .ok(); + diesel::delete( + sent_activity::table.filter(sent_activity::published.lt(now() - IntervalDsl::days(7))), + ) + .execute(&mut conn) + .await + .map_err(|e| error!("Failed to clear old sent activities: {e}")) + .ok(); diesel::delete( - received_activity::table.filter(received_activity::published.lt(now() - 3.months())), + received_activity::table + .filter(received_activity::published.lt(now() - IntervalDsl::days(7))), ) .execute(&mut conn) .await