From 245b24b8545b3ba758516b22b0c3e358672462c5 Mon Sep 17 00:00:00 2001 From: Terence Ong Date: Tue, 7 Apr 2026 15:04:16 +0700 Subject: [PATCH] fix: reduce bulk summary batch to 5 per request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous batch size of 50 exceeded PHP max_execution_time on Hostinger shared hosting (30s). Each article needs ~3s for the OpenRouter API call, so 5 articles per AJAX request keeps each batch under 20s. The JS loop still processes all articles automatically — just in more, smaller batches. Co-Authored-By: Claude Opus 4.6 --- includes/class-peptide-news-llm.php | 8 ++++---- peptide-news-plugin/includes/class-peptide-news-llm.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/class-peptide-news-llm.php b/includes/class-peptide-news-llm.php index 57a06a0..b0a35ed 100644 --- a/includes/class-peptide-news-llm.php +++ b/includes/class-peptide-news-llm.php @@ -411,10 +411,10 @@ class Peptide_News_LLM { ) ); } - // Process a generous batch — the 120-second timeout guard inside - // process_unanalyzed() will stop early if needed. Override the - // per-cycle limit since this is a manual admin action. - $batch_size = min( 50, $remaining ); + // Process a small batch per request to stay within PHP's + // max_execution_time (often 30s on shared hosting). The JS UI + // loops automatically until all articles are done. + $batch_size = min( 5, $remaining ); $processed = self::process_unanalyzed( $batch_size, true ); // Recount remaining after this batch. diff --git a/peptide-news-plugin/includes/class-peptide-news-llm.php b/peptide-news-plugin/includes/class-peptide-news-llm.php index 57a06a0..b0a35ed 100644 --- a/peptide-news-plugin/includes/class-peptide-news-llm.php +++ b/peptide-news-plugin/includes/class-peptide-news-llm.php @@ -411,10 +411,10 @@ class Peptide_News_LLM { ) ); } - // Process a generous batch — the 120-second timeout guard inside - // process_unanalyzed() will stop early if needed. Override the - // per-cycle limit since this is a manual admin action. - $batch_size = min( 50, $remaining ); + // Process a small batch per request to stay within PHP's + // max_execution_time (often 30s on shared hosting). The JS UI + // loops automatically until all articles are done. + $batch_size = min( 5, $remaining ); $processed = self::process_unanalyzed( $batch_size, true ); // Recount remaining after this batch.