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
path: root/core
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2020-12-02 10:04:02 +0300
committerGitHub <noreply@github.com>2020-12-02 10:04:02 +0300
commit7975de828c21d28b43120934e01ceba904557482 (patch)
treef818568d7ef8e2ace1bbe4088c5c4cdc0feece1d /core
parentadbe14c37cf5539978e0cbadf0fb54e3ec3eed4d (diff)
Fix ttl not being respected on existing invalidations (#16851)
* fix valid archive finding logic * fix test * fix test
Diffstat (limited to 'core')
-rw-r--r--core/CronArchive/QueueConsumer.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/core/CronArchive/QueueConsumer.php b/core/CronArchive/QueueConsumer.php
index 9bdbf3db96..d3886d97da 100644
--- a/core/CronArchive/QueueConsumer.php
+++ b/core/CronArchive/QueueConsumer.php
@@ -228,12 +228,15 @@ class QueueConsumer
continue;
}
- $archivedTime = $this->usableArchiveExists($invalidatedArchive);
- if ($archivedTime) {
+ list($isUsableExists, $archivedTime) = $this->usableArchiveExists($invalidatedArchive);
+ if ($isUsableExists) {
$now = Date::now()->getDatetime();
$this->logger->debug("Found invalidation with usable archive (not yet outdated, ts_archived of existing = $archivedTime, now = $now) skipping until archive is out of date: $invalidationDesc");
$this->addInvalidationToExclude($invalidatedArchive);
continue;
+ } else {
+ $now = Date::now()->getDatetime();
+ $this->logger->debug("No usable archive exists (ts_archived of existing = $archivedTime, now = $now).");
}
$alreadyInProgressId = $this->model->isArchiveAlreadyInProgress($invalidatedArchive);
@@ -536,22 +539,24 @@ class QueueConsumer
$params = new Parameters($site, $period, $segment);
// if latest archive includes today and is usable (DONE_OK or DONE_INVALIDATED and recent enough), skip
- $today = Date::factoryInTimezone('today', Site::getTimezoneFor($site->getId()))->subSeconds(1);
+ $today = Date::factoryInTimezone('today', Site::getTimezoneFor($site->getId()));
$isArchiveIncludesToday = $period->isDateInPeriod($today);
if (!$isArchiveIncludesToday) {
- return false;
+ return [false, null];
}
// if valid archive already exists, do not re-archive
$minDateTimeProcessedUTC = Date::now()->subSeconds(Rules::getPeriodArchiveTimeToLiveDefault($periodLabel));
$archiveIdAndVisits = ArchiveSelector::getArchiveIdAndVisits($params, $minDateTimeProcessedUTC, $includeInvalidated = false);
+ $tsArchived = !empty($archiveIdAndVisits[4]) ? Date::factory($archiveIdAndVisits[4])->getDatetime() : null;
+
$idArchive = $archiveIdAndVisits[0];
if (empty($idArchive)) {
- return false;
+ return [false, $tsArchived];
}
- return Date::factory($archiveIdAndVisits[4])->getDatetime();
+ return [true, $tsArchived];
}
public function getIdSite()