diff options
author | Ben Burgess <88810029+bx80@users.noreply.github.com> | 2022-02-02 02:19:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-02 02:19:23 +0300 |
commit | f20c4cbed3de7f3fcc49810d5721b257d5a56d43 (patch) | |
tree | da362660970e784654bf9f5ec1d4a55755ed1322 /plugins/ScheduledReports | |
parent | cbb297de4aed974716dd03acfee8832565ebf133 (diff) |
Retry scheduled tasks on failure (#18335)
* Catch and log errors for scheduled tasks
* Added retry on exception mechanism for scheduled tasks
* Replace error code with custom exception
* Fix/workaround for SchedulerTest mock breaking retry list option loading
* Log warning instead of info if a task has failed three times
* Added basic tests, minor code improvements
* Test fix
* Fix for test
* Added integration test to check that only tasks that throw exceptions are scheduled for retry
Diffstat (limited to 'plugins/ScheduledReports')
-rw-r--r-- | plugins/ScheduledReports/API.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/ScheduledReports/API.php b/plugins/ScheduledReports/API.php index e0934f45b8..2259c0e56b 100644 --- a/plugins/ScheduledReports/API.php +++ b/plugins/ScheduledReports/API.php @@ -28,6 +28,7 @@ use Piwik\Plugins\LanguagesManager\LanguagesManager; use Piwik\Plugins\SegmentEditor\API as APISegmentEditor; use Piwik\Plugins\SitesManager\API as SitesManagerApi; use Piwik\ReportRenderer; +use Piwik\Scheduler\RetryableException; use Piwik\Scheduler\Schedule\Schedule; use Piwik\Site; use Piwik\Translation\Translator; @@ -608,9 +609,9 @@ class API extends \Piwik\Plugin\API $report['period_param'] ); - } catch (Exception $e) { + } catch (\Throwable $e) { $this->enableSaveReportOnDisk = false; - throw $e; + throw new RetryableException($e->getMessage()); } $this->enableSaveReportOnDisk = false; |