Skip to content

Commit

Permalink
fix: prevent jobs from stopping the cron loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Feb 28, 2024
1 parent f308b90 commit 60f3680
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions includes/admin/feedzy-rss-feeds-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -1187,13 +1187,20 @@ public function run_cron( $max = 100 ) {
'post_status' => 'publish',
'numberposts' => 99,
);

$feedzy_imports = get_posts( $args );
foreach ( $feedzy_imports as $job ) {
$result = $this->run_job( $job, $max );
if ( empty( $result ) ) {
$this->run_job( $job, $max );
try {
$result = $this->run_job( $job, $max );
if ( empty( $result ) ) {
$this->run_job( $job, $max );
}
do_action( 'feedzy_run_cron_extra', $job );
} catch ( Exception $e ) {
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log( '[Feedzy Run Cron][Post title: ' . ( ! empty( $job->post_title ) ? $job->post_title : '' ) . '] Error: ' . $e->getMessage() );
}
}
do_action( 'feedzy_run_cron_extra', $job );
}
}

Expand Down

0 comments on commit 60f3680

Please sign in to comment.