From 2caaea0647eba38ac59c456aeae428e9d34c983b Mon Sep 17 00:00:00 2001 From: gugray Date: Sat, 23 Mar 2024 01:04:55 +0100 Subject: [PATCH] #50: 30s delay after delete to unblock everything else --- src/server/logic/feed_follower.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/server/logic/feed_follower.go b/src/server/logic/feed_follower.go index 2857317..efd7d31 100644 --- a/src/server/logic/feed_follower.go +++ b/src/server/logic/feed_follower.go @@ -638,13 +638,15 @@ func (ff *feedFollower) loseWeight(acct *dal.Account) { ff.logger.Errorf("Error getting follower count of feed: %s: %v", acct.Handle, err) return } - if followerCount == 0 { - ff.logger.Infof("Deleting account with 0 followers: %s", acct.Handle) - if err = ff.repo.BruteDeleteAccount(acct.Id); err != nil { - ff.logger.Errorf("Failed to brute-delete account: %s: %v", acct.Handle, err) - } + if followerCount != 0 { + return + } + ff.logger.Infof("Deleting account with 0 followers: %s", acct.Handle) + if err = ff.repo.BruteDeleteAccount(acct.Id); err != nil { + ff.logger.Errorf("Failed to brute-delete account: %s: %v", acct.Handle, err) return } + time.Sleep(30 * time.Second) } func (ff *feedFollower) updateDBSizeMetric() {