Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Burgess <88810029+bx80@users.noreply.github.com>2022-02-02 02:19:23 +0300
committerGitHub <noreply@github.com>2022-02-02 02:19:23 +0300
commitf20c4cbed3de7f3fcc49810d5721b257d5a56d43 (patch)
treeda362660970e784654bf9f5ec1d4a55755ed1322 /plugins/ScheduledReports
parentcbb297de4aed974716dd03acfee8832565ebf133 (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.php5
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;