hourly(); Schedule::call(function () { $article = Article::whereDoesntHave('articlePublications') ->where('is_valid', true) ->first(); if ($article) { try { logger()->info('Publishing article to Lemmy via scheduler', [ 'article_id' => $article->id, 'url' => $article->url ]); $extractedData = ArticleFetcher::fetchArticleData($article); LemmyPublisher::fromConfig()->publish($article, $extractedData); logger()->info('Successfully published article to Lemmy', [ 'article_id' => $article->id ]); } catch (Exception $e) { logger()->error('Failed to publish article to Lemmy via scheduler', [ 'article_id' => $article->id, 'error' => $e->getMessage() ]); } } else { logger()->debug('No unpublished valid articles found for Lemmy publishing'); } })->everyFiveMinutes()->name('publish-to-lemmy'); 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');