diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2020-11-26 09:26:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-26 09:26:55 +0300 |
commit | be3488e23d8b35452210db387e8ab39059d27da2 (patch) | |
tree | 0ae9795e4275bc12be8ca47fb2bf6492ccf55e21 /plugins/CoreConsole | |
parent | c3cb22117048ac18c8973af3da32f9697597c24b (diff) |
Invalidate everything once before a site is archived and do not inval… (#16796)
* Invalidate everything once before a site is archived and do not invalidate again until a core:archive run sees that site.
* remove no longer needed code
* do not invalidate if there is already an invalidation for the site from today
* remove ts_invalidated check + another query tweak
* fix test
* fix another test
Diffstat (limited to 'plugins/CoreConsole')
-rw-r--r-- | plugins/CoreConsole/tests/System/ArchiveCronTest.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/CoreConsole/tests/System/ArchiveCronTest.php b/plugins/CoreConsole/tests/System/ArchiveCronTest.php index db15ebba10..a3860198f5 100644 --- a/plugins/CoreConsole/tests/System/ArchiveCronTest.php +++ b/plugins/CoreConsole/tests/System/ArchiveCronTest.php @@ -7,6 +7,7 @@ */ namespace Piwik\Plugins\CoreConsole\tests\System; +use Piwik\CronArchive; use Psr\Container\ContainerInterface; use Piwik\Archive\ArchiveInvalidator; use Piwik\Common; @@ -117,7 +118,8 @@ class ArchiveCronTest extends SystemTestCase { // invalidate exampleplugin only archives in past $invalidator = StaticContainer::get(ArchiveInvalidator::class); - $invalidator->markArchivesAsInvalidated([1], ['2007-04-05'], 'day', new Segment('', [1]), false, false, 'ExamplePlugin'); + $invalidator->markArchivesAsInvalidated( + [1], ['2007-04-05'], 'day', new Segment('', [1]), false, false, 'ExamplePlugin'); // track a visit in 2007-04-05 so it will archive (don't want to force archiving because then this test will take another 15 mins) $tracker = Fixture::getTracker(1, '2007-04-05'); @@ -129,6 +131,10 @@ class ArchiveCronTest extends SystemTestCase $output = $this->runArchivePhpCron(); + Option::delete(CronArchive::OPTION_ARCHIVING_FINISHED_TS); // clear so segment re-archive logic runs on this run + Option::delete(CronArchive::CRON_INVALIDATION_TIME_OPTION_NAME); + $output = $this->runArchivePhpCron(); // have to run twice since we manually invalidate above + $expectedInvalidations = []; $invalidationEntries = $this->getInvalidatedArchiveTableEntries(); $this->assertEquals($expectedInvalidations, $invalidationEntries); @@ -165,6 +171,10 @@ class ArchiveCronTest extends SystemTestCase $output = $this->runArchivePhpCron(['-vvv' => null]); + Option::delete(CronArchive::OPTION_ARCHIVING_FINISHED_TS); // clear so segment re-archive logic runs on this run + Option::delete(CronArchive::CRON_INVALIDATION_TIME_OPTION_NAME); + $output = $this->runArchivePhpCron(); // have to run twice since we manually invalidate above + $this->runApiTests('ExamplePlugin.getExampleArchivedMetric', [ 'idSite' => 'all', 'date' => '2007-04-05', |