Catch mySqlGoneAway error from originated from MailPoet crons

MAILPOET-6020
This commit is contained in:
Oluwaseun Olorunsola
2024-05-24 00:01:18 +01:00
committed by Aschepikov
parent 988dec3e66
commit 81f29a61ac
4 changed files with 35 additions and 12 deletions

View File

@@ -2,6 +2,7 @@
namespace MailPoet\Cron\ActionScheduler;
use MailPoet\Util\Helpers;
use MailPoet\WP\Functions as WPFunctions;
class RemoteExecutorHandler {
@@ -41,9 +42,17 @@ class RemoteExecutorHandler {
}
public function runActionScheduler(): void {
$this->wp->addFilter('action_scheduler_queue_runner_concurrent_batches', [$this, 'ensureConcurrency']);
\ActionScheduler_QueueRunner::instance()->run();
wp_die();
try {
$this->wp->addFilter('action_scheduler_queue_runner_concurrent_batches', [$this, 'ensureConcurrency']);
\ActionScheduler_QueueRunner::instance()->run();
wp_die();
} catch (\Exception $e) {
$mySqlGoneAwayMessage = Helpers::mySqlGoneAwayExceptionHandler($e);
if ($mySqlGoneAwayMessage) {
throw new \Exception($mySqlGoneAwayMessage, 0, $e);
}
throw $e;
}
}
/**