Update FollowerService, add $silent param to remove method to more efficently purge relationships

This commit is contained in:
Daniel Supernault 2023-12-19 05:46:06 -07:00
parent a492a95a0e
commit 1664a5bc52
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -35,16 +35,18 @@ class FollowerService
Cache::forget('profile:following:' . $actor); 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::FOLLOWING_KEY . $actor, $target);
Redis::zrem(self::FOLLOWERS_KEY . $target, $actor); Redis::zrem(self::FOLLOWERS_KEY . $target, $actor);
Cache::forget('pf:services:follower:audience:' . $actor); if($silent !== true) {
Cache::forget('pf:services:follower:audience:' . $target);
AccountService::del($actor); AccountService::del($actor);
AccountService::del($target); AccountService::del($target);
RelationshipService::refresh($actor, $target); RelationshipService::refresh($actor, $target);
Cache::forget('profile:following:' . $actor); Cache::forget('profile:following:' . $actor);
} else {
RelationshipService::forget($actor, $target);
}
} }
public static function followers($id, $start = 0, $stop = 10) public static function followers($id, $start = 0, $stop = 10)