From 07d11499b2a4dd8976bc14274ad3a7f84797647a Mon Sep 17 00:00:00 2001 From: peptiderepo Date: Mon, 6 Apr 2026 00:56:23 +0700 Subject: [PATCH] fix(fetcher): use admin batch size setting, validate fetch_log type --- includes/class-peptide-news-fetcher.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-peptide-news-fetcher.php b/includes/class-peptide-news-fetcher.php index 23322c6..afd0da5 100644 --- a/includes/class-peptide-news-fetcher.php +++ b/includes/class-peptide-news-fetcher.php @@ -74,12 +74,12 @@ class Peptide_News_Fetcher { // Run AI analysis on newly fetched articles (keywords + summary). if ( class_exists( 'Peptide_News_LLM' ) && Peptide_News_LLM::is_enabled() ) { - $llm_batch_size = min( $stored + 5, 20 ); // Process recent unanalyzed, cap at 20. + $llm_batch_size = absint( get_option( 'peptide_news_llm_max_articles', 10 ) ); $llm_processed = Peptide_News_LLM::process_unanalyzed( $llm_batch_size ); // Append LLM stats to the fetch log. $fetch_log = get_option( 'peptide_news_last_fetch' ); - if ( $fetch_log ) { + if ( is_array( $fetch_log ) ) { $fetch_log['ai_processed'] = $llm_processed; update_option( 'peptide_news_last_fetch', $fetch_log ); }