Merge "parser: Avoid cache stampede on pages which use {{CURRENTYEAR}}"

This commit is contained in:
jenkins-bot 2024-08-26 16:00:08 +00:00 committed by Gerrit Code Review
commit 672f5d7e6b
2 changed files with 31 additions and 31 deletions

View file

@ -351,7 +351,7 @@ class CoreMagicVariables {
$ttl = max( $deadlineUnix - $tsUnix, self::MIN_DEADLINE_TTL );
$ttl += self::DEADLINE_TTL_CLOCK_FUDGE;
$ttl += ( $deadlineUnix % self::DEADLINE_TTL_STAGGER_MAX );
$ttl += ( $tsUnix % self::DEADLINE_TTL_STAGGER_MAX );
$parser->getOutput()->updateCacheExpiry( $ttl );
}

View file

@ -170,13 +170,13 @@ class MagicVariableTest extends MediaWikiIntegrationTestCase {
[ 'currentmonthname', '20200208153011', 'February', 604800 ],
[ 'currentmonthnamegen', '20200208153011', 'February', 604800 ],
[ 'currentmonthabbrev', '20200208153011', 'Feb', 604800 ],
[ 'currentday', '20200208153011', '8', 30590 ],
[ 'currentday2', '20200208153011', '08', 30590 ],
[ 'currentdayname', '20200208153011', 'Saturday', 30590 ],
[ 'currentday', '20200208153011', '8', 30601 ],
[ 'currentday2', '20200208153011', '08', 30601 ],
[ 'currentdayname', '20200208153011', 'Saturday', 30601 ],
[ 'currentyear', '20200208153011', '2020', 604800 ],
[ 'currenthour', '20200208153011', '15', 1790 ],
[ 'currentweek', '20200208153011', '6', 30590 ],
[ 'currentdow', '20200208153011', '6', 30590 ],
[ 'currenthour', '20200208153011', '15', 1801 ],
[ 'currentweek', '20200208153011', '6', 30601 ],
[ 'currentdow', '20200208153011', '6', 30601 ],
[ 'currenttime', '20200208153011', '15:30', 3600 ],
// Night
[ 'currentmonth', '20200208223011', '02', 604800 ],
@ -184,13 +184,13 @@ class MagicVariableTest extends MediaWikiIntegrationTestCase {
[ 'currentmonthname', '20200208223011', 'February', 604800 ],
[ 'currentmonthnamegen', '20200208223011', 'February', 604800 ],
[ 'currentmonthabbrev', '20200208223011', 'Feb', 604800 ],
[ 'currentday', '20200208223011', '8', 5390 ],
[ 'currentday2', '20200208223011', '08', 5390 ],
[ 'currentdayname', '20200208223011', 'Saturday', 5390 ],
[ 'currentday', '20200208223011', '8', 5401 ],
[ 'currentday2', '20200208223011', '08', 5401 ],
[ 'currentdayname', '20200208223011', 'Saturday', 5401 ],
[ 'currentyear', '20200208223011', '2020', 604800 ],
[ 'currenthour', '20200208223011', '22', 1790 ],
[ 'currentweek', '20200208223011', '6', 5390 ],
[ 'currentdow', '20200208223011', '6', 5390 ],
[ 'currenthour', '20200208223011', '22', 1801 ],
[ 'currentweek', '20200208223011', '6', 5401 ],
[ 'currentdow', '20200208223011', '6', 5401 ],
[ 'currenttime', '20200208223011', '22:30', 3600 ]
];
}
@ -204,13 +204,13 @@ class MagicVariableTest extends MediaWikiIntegrationTestCase {
[ 'localmonthname', '20200208153011', 'February', 604800 ],
[ 'localmonthnamegen', '20200208153011', 'February', 604800 ],
[ 'localmonthabbrev', '20200208153011', 'Feb', 604800 ],
[ 'localday', '20200208153011', '8', 26990 ],
[ 'localday2', '20200208153011', '08', 26990 ],
[ 'localdayname', '20200208153011', 'Saturday', 26990 ],
[ 'localday', '20200208153011', '8', 27001 ],
[ 'localday2', '20200208153011', '08', 27001 ],
[ 'localdayname', '20200208153011', 'Saturday', 27001 ],
[ 'localyear', '20200208153011', '2020', 604800 ],
[ 'localhour', '20200208153011', '16', 1790 ],
[ 'localweek', '20200208153011', '6', 26990 ],
[ 'localdow', '20200208153011', '6', 26990 ],
[ 'localhour', '20200208153011', '16', 1801 ],
[ 'localweek', '20200208153011', '6', 27001 ],
[ 'localdow', '20200208153011', '6', 27001 ],
[ 'localtime', '20200208153011', '16:30', 3600 ],
// Night
[ 'localmonth', '20200208223011', '02', 604800 ],
@ -218,13 +218,13 @@ class MagicVariableTest extends MediaWikiIntegrationTestCase {
[ 'localmonthname', '20200208223011', 'February', 604800 ],
[ 'localmonthnamegen', '20200208223011', 'February', 604800 ],
[ 'localmonthabbrev', '20200208223011', 'Feb', 604800 ],
[ 'localday', '20200208223011', '8', 1790 ],
[ 'localday2', '20200208223011', '08', 1790 ],
[ 'localdayname', '20200208223011', 'Saturday', 1790 ],
[ 'localday', '20200208223011', '8', 1801 ],
[ 'localday2', '20200208223011', '08', 1801 ],
[ 'localdayname', '20200208223011', 'Saturday', 1801 ],
[ 'localyear', '20200208223011', '2020', 604800 ],
[ 'localhour', '20200208223011', '23', 1790 ],
[ 'localweek', '20200208223011', '6', 1790 ],
[ 'localdow', '20200208223011', '6', 1790 ],
[ 'localhour', '20200208223011', '23', 1801 ],
[ 'localweek', '20200208223011', '6', 1801 ],
[ 'localdow', '20200208223011', '6', 1801 ],
[ 'localtime', '20200208223011', '23:30', 3600 ],
// Late night / early morning
[ 'localmonth', '20200208233011', '02', 604800 ],
@ -232,13 +232,13 @@ class MagicVariableTest extends MediaWikiIntegrationTestCase {
[ 'localmonthname', '20200208233011', 'February', 604800 ],
[ 'localmonthnamegen', '20200208233011', 'February', 604800 ],
[ 'localmonthabbrev', '20200208233011', 'Feb', 604800 ],
[ 'localday', '20200208233011', '9', 84590 ],
[ 'localday2', '20200208233011', '09', 84590 ],
[ 'localdayname', '20200208233011', 'Sunday', 84590 ],
[ 'localday', '20200208233011', '9', 84601 ],
[ 'localday2', '20200208233011', '09', 84601 ],
[ 'localdayname', '20200208233011', 'Sunday', 84601 ],
[ 'localyear', '20200208233011', '2020', 604800 ],
[ 'localhour', '20200208233011', '00', 1790 ],
[ 'localweek', '20200208233011', '6', 84590 ],
[ 'localdow', '20200208233011', '0', 84590 ],
[ 'localhour', '20200208233011', '00', 1801 ],
[ 'localweek', '20200208233011', '6', 84601 ],
[ 'localdow', '20200208233011', '0', 84601 ],
[ 'localtime', '20200208233011', '00:30', 3600 ]
];
}