From 36dd6dbab478cbbaa34e13dc672734594ab45ddf Mon Sep 17 00:00:00 2001 From: Dima Krasner Date: Mon, 2 Oct 2023 09:08:31 +0300 Subject: [PATCH] delete failed follows after 2d --- data/garbage.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/garbage.go b/data/garbage.go index 3af3b875..a1c15456 100644 --- a/data/garbage.go +++ b/data/garbage.go @@ -54,5 +54,9 @@ func CollectGarbage(ctx context.Context, db *sql.DB) error { return fmt.Errorf("Failed to remove old posts: %w", err) } + if _, err := db.ExecContext(ctx, `delete from follows where accepted = 0 and inserted < unixepoch()-60*60*24*2`); err != nil { + return fmt.Errorf("Failed to remove failed follow requests: %w", err) + } + return nil }