fedi-feed-router/routes/console.php
2025-07-03 21:17:13 +02:00

29 lines
886 B
PHP

<?php
use App\Console\Commands\FetchNewArticlesCommand;
use App\Enums\PlatformEnum;
use App\Jobs\SyncChannelPostsJob;
use Illuminate\Support\Facades\Schedule;
Schedule::command(FetchNewArticlesCommand::class)->hourly();
Schedule::call(function () {
$communityId = config('lemmy.community_id');
$communityName = config('lemmy.community');
if ($communityId && $communityName) {
SyncChannelPostsJob::dispatch(
PlatformEnum::LEMMY,
$communityId,
$communityName
);
logger()->info('Dispatched channel posts sync job', [
'platform' => 'lemmy',
'community_id' => $communityId,
'community_name' => $communityName
]);
} else {
logger()->warning('Missing Lemmy community configuration for sync job');
}
})->everyTenMinutes()->name('sync-lemmy-channel-posts');