Update NotificationEpochUpdatePipeline, use more efficient query

pull/4897/head
Daniel Supernault 2024-02-04 07:11:05 -07:00
rodzic 152b6eab9a
commit 4d4013896c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 23740873EE6F76A1
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

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