Fix false stall detection for multi-article chained generation
The frontend status poller measured elapsed time from `started` (set once at the beginning of the run) and declared a stall at 300s. Three articles take ~6 minutes total, so the poller always false-alarmed on article 3. Now every stage broadcast writes `last_updated` into the transient, and the stall check compares idle time since the last update — not since the run started. This lets N-article runs complete without false timeout as long as each individual article finishes within 5 minutes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -213,9 +213,10 @@ class PRAutoBlogger_Pipeline_Runner {
|
||||
|
||||
$current = get_transient( 'prautoblogger_generation_status' );
|
||||
set_transient( 'prautoblogger_generation_status', [
|
||||
'status' => 'running',
|
||||
'stage' => sprintf( __( 'Generating article %1$d of %2$d…', 'prautoblogger' ), $done + 1, $total ),
|
||||
'started' => is_array( $current ) ? ( $current['started'] ?? time() ) : time(),
|
||||
'status' => 'running',
|
||||
'stage' => sprintf( __( 'Generating article %1$d of %2$d…', 'prautoblogger' ), $done + 1, $total ),
|
||||
'started' => is_array( $current ) ? ( $current['started'] ?? time() ) : time(),
|
||||
'last_updated' => time(),
|
||||
], 600 );
|
||||
}
|
||||
|
||||
@@ -256,7 +257,8 @@ class PRAutoBlogger_Pipeline_Runner {
|
||||
$key = 'prautoblogger_generation_status';
|
||||
$current = get_transient( $key );
|
||||
if ( is_array( $current ) && 'running' === ( $current['status'] ?? '' ) ) {
|
||||
$current['stage'] = $stage;
|
||||
$current['stage'] = $stage;
|
||||
$current['last_updated'] = time();
|
||||
set_transient( $key, $current, 600 );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user