From df41aa3da19e5f817d1c05b7488fbe1122f7cde9 Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Wed, 30 Oct 2024 15:39:10 -0400 Subject: Add ParserOutputFlags::{HAS_ASYNC_CONTENT,ASYNC_NOT_READY} This allows Parsoid to mark parses which contain async content which is "not ready yet". At the moment this output is cached with a reduced TTL, although in the future it might still be treated as uncacheable, cached until evicted, or some other option. The HAS_ASYNC_CONTENT flag along with ParserOutput::hasReducedExpiry() ensures that RefreshLinksJob is opportunistically reinvoked whenever the page is reparsed, since the asynchronous content may change the metadata for the page when it becomes ready. As describe in T373256, ::hasReducedExpiry() is misnamed now, and a follow-up patch will probably rename it to ::hasDynamicContent() or something like that. What it really means is "RefreshLinksJob must be re-run on every parse, because the content may change on each parse". In the past we would *also* reduce the cache time for pages like this. But for asynchronous content, "the content may change on each parse" only *until* the asynchronous content is "ready". Once it is ready the contents will no longer change, and the cache lifetime can be raised again -- but ::hasDynamicContent() still needs to be set, which in the future will mean "you need to check that RefreshLinksJob has last run" not "you must always run RefreshLinksJob". Asynchronous content will always set HAS_ASYNC_CONTENT, even after the content is "ready", but will only set ASYNC_NOT_READY if it needed to use placeholder content in this render. Bug: T373256 Change-Id: I71e10f8a9133c16ebd9120c23c965b9ff20dabd2 --- includes/MainConfigNames.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'includes/MainConfigNames.php') diff --git a/includes/MainConfigNames.php b/includes/MainConfigNames.php index 9a39654b7ae6..48b1a29a2d93 100644 --- a/includes/MainConfigNames.php +++ b/includes/MainConfigNames.php @@ -1553,6 +1553,12 @@ class MainConfigNames { */ public const ParserCacheExpireTime = 'ParserCacheExpireTime'; + /** + * Name constant for the ParserCacheAsyncExpireTime setting, for use with Config::get() + * @see MainConfigSchema::ParserCacheAsyncExpireTime + */ + public const ParserCacheAsyncExpireTime = 'ParserCacheAsyncExpireTime'; + /** * Name constant for the OldRevisionParserCacheExpireTime setting, for use with Config::get() * @see MainConfigSchema::OldRevisionParserCacheExpireTime -- cgit v1.2.3