From 1664a5bc52fc62dc4f5c099cc75c189ccc4b0e27 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 19 Dec 2023 05:46:06 -0700 Subject: [PATCH] Update FollowerService, add $silent param to remove method to more efficently purge relationships --- app/Services/FollowerService.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/Services/FollowerService.php b/app/Services/FollowerService.php index dcb7a1158..cec8f7068 100644 --- a/app/Services/FollowerService.php +++ b/app/Services/FollowerService.php @@ -35,16 +35,18 @@ class FollowerService Cache::forget('profile:following:' . $actor); } - public static function remove($actor, $target) + public static function remove($actor, $target, $silent = false) { Redis::zrem(self::FOLLOWING_KEY . $actor, $target); Redis::zrem(self::FOLLOWERS_KEY . $target, $actor); - Cache::forget('pf:services:follower:audience:' . $actor); - Cache::forget('pf:services:follower:audience:' . $target); - AccountService::del($actor); - AccountService::del($target); - RelationshipService::refresh($actor, $target); - Cache::forget('profile:following:' . $actor); + if($silent !== true) { + AccountService::del($actor); + AccountService::del($target); + RelationshipService::refresh($actor, $target); + Cache::forget('profile:following:' . $actor); + } else { + RelationshipService::forget($actor, $target); + } } public static function followers($id, $start = 0, $stop = 10)