43 private $wikiPageFactory;
72 throw new InvalidArgumentException(
'$page parameter mismatches $revision parameter' );
77 $this->workKey = $workKey;
79 $this->parserCache = $parserCache;
80 $this->lbFactory = $lbFactory;
81 $this->wikiPageFactory = $wikiPageFactory;
94 $output = $status->getValue();
97 if ( $this->cacheable && $output->isCacheable() ) {
98 $this->parserCache->save(
101 $this->parserOptions,
103 $this->revision->getId()
107 $this->wikiPageFactory->newFromTitle( $this->page )
108 ->triggerOpportunisticLinksUpdate( $output );
118 $parserOutput = $this->parserCache->get( $this->page, $this->parserOptions );
120 $logger = $this->loggerSpi->getLogger(
'PoolWorkArticleView' );
121 $logger->debug( $parserOutput ?
'parser cache hit' :
'parser cache miss' );
131 $parserOutput = $this->parserCache->getDirty( $this->page, $this->parserOptions );
133 $logger = $this->loggerSpi->getLogger(
'dirty' );
135 if ( !$parserOutput ) {
136 $logger->info(
'dirty missing' );
150 $lastWriteTime = $this->lbFactory->getChronologyProtectorTouched();
151 $cacheTime = MWTimestamp::convert( TS_UNIX, $parserOutput->getCacheTime() );
152 if ( $lastWriteTime && $cacheTime <= $lastWriteTime ) {
154 'declining to send dirty output since cache time ' .
155 '{cacheTime} is before last write time {lastWriteTime}',
157 'workKey' => $this->workKey,
158 'cacheTime' => $cacheTime,
159 'lastWriteTime' => $lastWriteTime,
169 $logger->info( $fast ?
'fast dirty output' :
'dirty output', [
'workKey' => $this->workKey ] );
172 $status->warning(
'view-pool-dirty-output' );
173 $status->warning( $fast ?
'view-pool-contention' :
'view-pool-overload' );
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
Service for creating WikiPage objects.
Cache for ParserOutput objects corresponding to the latest page revisions.
Set options of the Parser.
PoolWorkArticleView for the current revision of a page, using ParserCache.
__construct(string $workKey, PageRecord $page, RevisionRecord $revision, ParserOptions $parserOptions, RevisionRenderer $revisionRenderer, ParserCache $parserCache, ILBFactory $lbFactory, LoggerSpi $loggerSpi, WikiPageFactory $wikiPageFactory, bool $cacheable=true)
PoolCounter protected work wrapping RenderedRevision->getRevisionParserOutput.
ParserOptions $parserOptions
static newGood( $value=null)
Factory function for good results.
getId( $wikiId=self::LOCAL)
Returns the page ID.