feat: chain per-article cron jobs to eliminate execution time ceiling

The pipeline previously ran all articles sequentially in a single PHP
process. On Hostinger, this timed out at ~120s — enough for 1 article
but not 2+. Now the pipeline generates article 1 in-process, then
queues articles 2..N as individual WP-Cron events. Each article gets
its own PHP process with its own execution time budget, so we can
generate any number of articles regardless of server time limits.

Architecture:
- Pipeline_Runner: orchestrate (collect+analyze+score) + first article,
  then serialize remaining ideas to wp_options and chain cron events
- Article_Worker (new): focused single-article worker extracted from
  the pipeline loop — content gen + editorial + publish
- Executor: new on_process_article_queue() handler for chained events;
  status poller re-schedules orphaned queue jobs automatically
- Article_Idea: added to_array() for queue serialization

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
peptiderepo
2026-04-19 03:26:37 +07:00
parent c866637a95
commit ef40ce91d4
6 changed files with 465 additions and 193 deletions

View File

@@ -84,4 +84,25 @@ class PRAutoBlogger_Article_Idea {
public function get_target_keywords(): array {
return $this->target_keywords;
}
/**
* Serialize to array for storage in options/transients.
*
* Used by the pipeline queue to persist ideas across chained cron jobs.
*
* @return array<string, mixed> Constructor-compatible array.
*/
public function to_array(): array {
return [
'topic' => $this->topic,
'article_type' => $this->article_type,
'suggested_title' => $this->suggested_title,
'summary' => $this->summary,
'score' => $this->score,
'analysis_id' => $this->analysis_id,
'source_ids' => $this->source_ids,
'key_points' => $this->key_points,
'target_keywords' => $this->target_keywords,
];
}
}