environment(['production', 'testing']) || ! config('editorial.indexnow_enabled', app()->environment('production'))) { $this->line('IndexNow retry disabled in this environment.'); return self::SUCCESS; } $ids = DB::table('editorial_publications')->where('effects->indexnow->status', 'pending') ->where(function ($q) { $q->whereNull('effects->indexnow->next_attempt_at') ->orWhere('effects->indexnow->next_attempt_at', '<=', now()->timestamp); })->orderBy('updated_at')->limit(10)->pluck('id'); $pending = 0; foreach ($ids as $id) { try { $receipt = app(PublicationEffects::class)->synchronize($id); $pending += ($receipt['effects']['indexnow']['status'] ?? '') === 'pending' ? 1 : 0; } catch (\Throwable) { $pending++; } } $this->line(json_encode(['processed' => count($ids), 'pending' => $pending])); return $pending ? self::FAILURE : self::SUCCESS; } }