mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-22 04:53:17 +00:00
Update FollowerService, add quickCheck to follows method for non cold-boot checks
This commit is contained in:
parent
e5d789e0ab
commit
d3f032b2ec
1 changed files with 5 additions and 1 deletions
|
@ -89,12 +89,16 @@ class FollowerService
|
|||
return Redis::zCard(self::FOLLOWING_KEY . $id);
|
||||
}
|
||||
|
||||
public static function follows(string $actor, string $target)
|
||||
public static function follows(string $actor, string $target, $quickCheck = false)
|
||||
{
|
||||
if($actor == $target) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if($quickCheck) {
|
||||
return (bool) Redis::zScore(self::FOLLOWERS_KEY . $target, $actor);
|
||||
}
|
||||
|
||||
if(self::followerCount($target, false) && self::followingCount($actor, false)) {
|
||||
self::cacheSyncCheck($target, 'followers');
|
||||
return (bool) Redis::zScore(self::FOLLOWERS_KEY . $target, $actor);
|
||||
|
|
Loading…
Reference in a new issue