74 public function error( $status ) {
85 $key = $this->poolCounter->getKey();
87 wfDebugLog(
'poolcounter',
"Pool key '$key' ({$this->type}): "
88 . $status->getMessage()->inLanguage(
'en' )->useDatabase(
false )->text() );
106 public function execute( $skipcache =
false ) {
107 if ( $this->cacheable && !$skipcache ) {
108 $status = $this->poolCounter->acquireForAnyone();
110 $status = $this->poolCounter->acquireForMe();
113 if ( !$status->isOK() ) {
119 switch ( $status->value ) {
125 $result = $this->
doWork();
126 $this->poolCounter->release();
131 if ( $result ===
false ) {
143 if ( $result !==
false ) {
155 $status = Status::newFatal( $errors[$status->value] ??
'pool-errorunknown' );
157 return $this->
error( $status );
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
Class for dealing with PoolCounters using class members.
error( $status)
Do something with the error, like showing it to the user.
fallback()
A work not so good (eg.
getCachedWork()
Retrieve the work from cache.
execute( $skipcache=false)
Get the result of the work (whatever it is), or the result of the error() function.
doWork()
Actually perform the work, caching it if needed.
logError( $status)
Log an error.
__construct( $type, $key)
When you have many workers (threads/servers) giving service, and a cached item expensive to produce e...
static factory( $type, $key)
Create a Pool counter.