-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip invalidating segments for today if flag is provided #22519
Conversation
if ($isYesterday) { | ||
// Skip invalidation for yesterday if archiving for yesterday was already started after midnight in site's timezone | ||
$invalidationsInProgress = $this->model->getInvalidationsInProgress($idSite); | ||
$today = Date::factoryInTimezone('today', $timezone); | ||
|
||
foreach ($invalidationsInProgress as $invalidation) { | ||
if ( | ||
$invalidation['period'] == Day::PERIOD_ID | ||
&& $date->toString() === $invalidation['date1'] | ||
&& Date::factory($invalidation['ts_started'], $timezone)->getTimestamp() >= $today->getTimestamp() | ||
) { | ||
$this->logger->debug(" " . ucfirst($dateStr) . " archive already in process for idSite = $idSite, skipping invalidation..."); | ||
return; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check was incorrect here. On the one side it missed to check the done flag, causing any running archive to prevent a new invalidation. On the other side a running invalidation prevented any segment from being invalidated.
Therefor the check was moved to invalidateWithSegments
method, where it is done for each segment separately.
…ts-today is given
Description:
The
core:archive
command provides a flag--skip-segments-today
, which prevents segments data from being processed for today.The currently implementation only prevents them from being processed. But invalidation done for today before archiving is started is currently done anyway. This causes also the higher periods (week, month, year) to be invalidated. But as only today is prevented from being archived for segments, those higher periods will be reprocessed anyway, even if there actually were no changes in lower periods.
To prevent this unnecessary archiving of those higher periods, this PR changes the behavior of the initial invalidation. If
--skip-segments-today
is provided, we will no longer create invalidations for segments for today (and periods including this day).This shouldn't cause any problems even if the flag is used always when archiving is triggered, as
yesterday
will still be invalidated for segments.Review