fedi-feed-router/routes/console.php

30 lines
886 B
PHP
Raw Permalink Normal View History

2025-06-29 08:50:03 +02:00
<?php
2025-06-29 09:37:49 +02:00
use App\Console\Commands\FetchNewArticlesCommand;
2025-06-30 19:54:43 +02:00
use App\Enums\PlatformEnum;
use App\Jobs\SyncChannelPostsJob;
2025-06-29 09:37:49 +02:00
use Illuminate\Support\Facades\Schedule;
2025-06-29 08:50:03 +02:00
2025-06-29 18:34:13 +02:00
Schedule::command(FetchNewArticlesCommand::class)->hourly();
2025-06-30 18:18:30 +02:00
2025-06-30 19:54:43 +02:00
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');