mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-22 13:03:16 +00:00
Update NotificationEpochUpdatePipeline, use more efficient query
This commit is contained in:
parent
152b6eab9a
commit
4d4013896c
1 changed files with 6 additions and 1 deletions
|
@ -61,7 +61,12 @@ class NotificationEpochUpdatePipeline implements ShouldQueue, ShouldBeUniqueUnti
|
|||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$rec = Notification::where('created_at', '>', now()->subMonths(6))->first();
|
||||
$pid = Cache::get(NotificationService::EPOCH_CACHE_KEY . '6');
|
||||
if($pid && $pid > 1) {
|
||||
$rec = Notification::where('id', '>', $pid)->whereDate('created_at', now()->subMonths(6)->format('Y-m-d'))->first();
|
||||
} else {
|
||||
$rec = Notification::whereDate('created_at', now()->subMonths(6)->format('Y-m-d'))->first();
|
||||
}
|
||||
$id = 1;
|
||||
if($rec) {
|
||||
$id = $rec->id;
|
||||
|
|
Loading…
Reference in a new issue