fedi-feed-router/app/Jobs/ArticleDiscoveryJob.php

34 lines
801 B
PHP
Raw Permalink Normal View History

2025-07-05 18:26:04 +02:00
<?php
namespace App\Jobs;
2025-07-10 11:01:01 +02:00
use App\Models\Setting;
2025-07-05 18:26:04 +02:00
use App\Services\Log\LogSaver;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
class ArticleDiscoveryJob implements ShouldQueue
{
use Queueable;
public function __construct()
{
$this->onQueue('feed-discovery');
}
2025-08-15 02:50:42 +02:00
public function handle(LogSaver $logSaver): void
2025-07-05 18:26:04 +02:00
{
2025-07-10 11:01:01 +02:00
if (!Setting::isArticleProcessingEnabled()) {
2025-08-15 02:50:42 +02:00
$logSaver->info('Article processing is disabled. Article discovery skipped.');
2025-07-10 11:01:01 +02:00
return;
}
2025-08-15 02:50:42 +02:00
$logSaver->info('Starting article discovery for all active feeds');
2025-08-10 01:26:56 +02:00
2025-07-05 18:26:04 +02:00
ArticleDiscoveryForFeedJob::dispatchForAllActiveFeeds();
2025-08-10 01:26:56 +02:00
2025-08-15 02:50:42 +02:00
$logSaver->info('Article discovery jobs dispatched for all active feeds');
2025-07-05 18:26:04 +02:00
}
}