Only keep sent and received activities for 7 days (fixes #4113, fixes #4110) (#4131)

This commit is contained in:
Nutomic 2023-11-06 22:17:53 +01:00 committed by GitHub
parent 97a4fb9a72
commit cb01427dcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -295,14 +295,17 @@ async fn clear_old_activities(pool: &mut DbPool<'_>) {
match conn { match conn {
Ok(mut conn) => { Ok(mut conn) => {
diesel::delete(sent_activity::table.filter(sent_activity::published.lt(now() - 3.months()))) diesel::delete(
sent_activity::table.filter(sent_activity::published.lt(now() - IntervalDsl::days(7))),
)
.execute(&mut conn) .execute(&mut conn)
.await .await
.map_err(|e| error!("Failed to clear old sent activities: {e}")) .map_err(|e| error!("Failed to clear old sent activities: {e}"))
.ok(); .ok();
diesel::delete( 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) .execute(&mut conn)
.await .await