Update FeedFollowPipeline, use more efficient query

pull/4752/head
Daniel Supernault 2023-11-12 23:00:33 -07:00
rodzic 115a9d2dec
commit 43443503a1
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 23740873EE6F76A1
2 zmienionych plików z 9 dodań i 2 usunięć

Wyświetl plik

@ -12,6 +12,7 @@ use Illuminate\Queue\Middleware\WithoutOverlapping;
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
use App\Services\AccountService;
use App\Services\HomeTimelineService;
use App\Services\SnowflakeService;
use App\Status;
class FeedFollowPipeline implements ShouldQueue, ShouldBeUniqueUntilProcessing
@ -68,7 +69,10 @@ class FeedFollowPipeline implements ShouldQueue, ShouldBeUniqueUntilProcessing
$actorId = $this->actorId;
$followingId = $this->followingId;
$ids = Status::where('profile_id', $followingId)
$minId = SnowflakeService::byDate(now()->subMonths(6));
$ids = Status::where('id', '>', $minId)
->where('profile_id', $followingId)
->whereNull(['in_reply_to_id', 'reblog_of_id'])
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
->whereIn('visibility',['public', 'unlisted', 'private'])

Wyświetl plik

@ -73,7 +73,10 @@ class HomeTimelineService
return $following->push($id)->toArray();
});
$ids = Status::whereIn('profile_id', $following)
$minId = SnowflakeService::byDate(now()->subMonths(6));
$ids = Status::where('id', '>', $minId)
->whereIn('profile_id', $following)
->whereNull(['in_reply_to_id', 'reblog_of_id'])
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
->whereIn('visibility',['public', 'unlisted', 'private'])