Update FollowerService, add quickCheck to follows method for non cold-boot checks

pull/4834/head
Daniel Supernault 2023-12-16 06:11:13 -07:00
rodzic e5d789e0ab
commit d3f032b2ec
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 23740873EE6F76A1
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -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);