Go to the documentation of this file.
79 public function error( $status ) {
89 return $this->poolCounter->isFastStaleEnabled();
99 $key = $this->poolCounter->getKey();
101 wfDebugLog(
'poolcounter',
"Pool key '$key' ({$this->type}): "
102 . $status->getMessage()->inLanguage(
'en' )->useDatabase(
false )->text() );
127 public function execute( $skipcache =
false ) {
128 if ( $this->cacheable && !$skipcache ) {
132 $status = $this->poolCounter->acquireForAnyone( 0 );
135 $staleResult = $this->
fallback(
true );
136 if ( $staleResult !==
false ) {
140 $status = $this->poolCounter->acquireForAnyone();
143 $status = $this->poolCounter->acquireForAnyone();
146 $status = $this->poolCounter->acquireForMe();
149 if ( !$status->isOK() ) {
155 switch ( $status->value ) {
164 $this->poolCounter->release();
169 if ( $result ===
false ) {
181 if ( $result !==
false ) {
193 $status =
Status::newFatal( $errors[$status->value] ??
'pool-errorunknown' );
195 return $this->
error( $status );
static newFatal( $message,... $parameters)
Factory function for fatal errors.
isFastStaleEnabled()
Should fast stale mode be used?
__construct(string $type, string $key, PoolCounter $poolCounter=null)
doWork()
Actually perform the work, caching it if needed.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
When you have many workers (threads/servers) giving service, and a cached item expensive to produce e...
execute( $skipcache=false)
Get the result of the work (whatever it is), or the result of the error() function.
getCachedWork()
Retrieve the work from cache.
static factory(string $type, string $key)
Create a Pool counter.
fallback( $fast)
A work not so good (eg.
error( $status)
Do something with the error, like showing it to the user.
Class for dealing with PoolCounters using class members.
logError( $status)
Log an error.