Skip to content

Commit

Permalink
Only keep sent activities for 7 days (fixes #4113)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutomic committed Nov 3, 2023
1 parent 1e59e7a commit e468dec
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/scheduled_tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,13 @@ 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())),
Expand Down

0 comments on commit e468dec

Please sign in to comment.