MediaWiki  master
JobRunner.php
Go to the documentation of this file.
1 <?php
26 use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
27 use Psr\Log\LoggerAwareInterface;
28 use Psr\Log\LoggerInterface;
29 use Wikimedia\ScopedCallback;
32 
39 class JobRunner implements LoggerAwareInterface {
41  protected $config;
43  protected $debug;
44 
48  protected $logger;
49 
50  const MAX_ALLOWED_LAG = 3; // abort if more than this much DB lag is present
51  const LAG_CHECK_PERIOD = 1.0; // check replica DB lag this many seconds
52  const ERROR_BACKOFF_TTL = 1; // seconds to back off a queue due to errors
53  const READONLY_BACKOFF_TTL = 30; // seconds to back off a queue due to read-only errors
54 
58  public function setDebugHandler( $debug ) {
59  $this->debug = $debug;
60  }
61 
66  public function setLogger( LoggerInterface $logger ) {
67  $this->logger = $logger;
68  }
69 
73  public function __construct( LoggerInterface $logger = null ) {
74  if ( $logger === null ) {
75  $logger = LoggerFactory::getInstance( 'runJobs' );
76  }
77  $this->setLogger( $logger );
78  $this->config = MediaWikiServices::getInstance()->getMainConfig();
79  }
80 
105  public function run( array $options ) {
106  $jobClasses = $this->config->get( 'JobClasses' );
107  $profilerLimits = $this->config->get( 'TrxProfilerLimits' );
108 
109  $response = [ 'jobs' => [], 'reached' => 'none-ready' ];
110 
111  $type = $options['type'] ?? false;
112  $maxJobs = $options['maxJobs'] ?? false;
113  $maxTime = $options['maxTime'] ?? false;
114  $noThrottle = isset( $options['throttle'] ) && !$options['throttle'];
115 
116  // Bail if job type is invalid
117  if ( $type !== false && !isset( $jobClasses[$type] ) ) {
118  $response['reached'] = 'none-possible';
119  return $response;
120  }
121 
122  // Bail out if DB is in read-only mode
123  if ( wfReadOnly() ) {
124  $response['reached'] = 'read-only';
125  return $response;
126  }
127 
128  $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
129  if ( $lbFactory->hasTransactionRound() ) {
130  throw new LogicException( __METHOD__ . ' called with an active transaction round.' );
131  }
132  // Bail out if there is too much DB lag.
133  // This check should not block as we want to try other wiki queues.
134  list( , $maxLag ) = $lbFactory->getMainLB()->getMaxLag();
135  if ( $maxLag >= self::MAX_ALLOWED_LAG ) {
136  $response['reached'] = 'replica-lag-limit';
137  return $response;
138  }
139 
140  // Use an appropriate timeout to balance lag avoidance and job progress
141  $oldTimeout = $lbFactory->setDefaultReplicationWaitTimeout( self::MAX_ALLOWED_LAG );
143  $restorer = new ScopedCallback( function () use ( $lbFactory, $oldTimeout ) {
144  $lbFactory->setDefaultReplicationWaitTimeout( $oldTimeout );
145  } );
146 
147  // Catch huge single updates that lead to replica DB lag
148  $trxProfiler = Profiler::instance()->getTransactionProfiler();
149  $trxProfiler->setLogger( LoggerFactory::getInstance( 'DBPerformance' ) );
150  $trxProfiler->setExpectations( $profilerLimits['JobRunner'], __METHOD__ );
151 
152  // Some jobs types should not run until a certain timestamp
153  $backoffs = []; // map of (type => UNIX expiry)
154  $backoffDeltas = []; // map of (type => seconds)
155  $wait = 'wait'; // block to read backoffs the first time
156 
157  $group = JobQueueGroup::singleton();
158  $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
159  $jobsPopped = 0;
160  $timeMsTotal = 0;
161  $startTime = microtime( true ); // time since jobs started running
162  $lastCheckTime = 1; // timestamp of last replica DB check
163  do {
164  // Sync the persistent backoffs with concurrent runners
165  $backoffs = $this->syncBackoffDeltas( $backoffs, $backoffDeltas, $wait );
166  $blacklist = $noThrottle ? [] : array_keys( $backoffs );
167  $wait = 'nowait'; // less important now
168 
169  if ( $type === false ) {
170  $job = $group->pop(
173  $blacklist
174  );
175  } elseif ( in_array( $type, $blacklist ) ) {
176  $job = false; // requested queue in backoff state
177  } else {
178  $job = $group->pop( $type ); // job from a single queue
179  }
180 
181  if ( $job ) { // found a job
182  ++$jobsPopped;
183  $popTime = time();
184  $jType = $job->getType();
185 
186  WebRequest::overrideRequestId( $job->getRequestId() );
187 
188  // Back off of certain jobs for a while (for throttling and for errors)
189  $ttw = $this->getBackoffTimeToWait( $job );
190  if ( $ttw > 0 ) {
191  // Always add the delta for other runners in case the time running the
192  // job negated the backoff for each individually but not collectively.
193  $backoffDeltas[$jType] = isset( $backoffDeltas[$jType] )
194  ? $backoffDeltas[$jType] + $ttw
195  : $ttw;
196  $backoffs = $this->syncBackoffDeltas( $backoffs, $backoffDeltas, $wait );
197  }
198 
199  $info = $this->executeJob( $job, $lbFactory, $stats, $popTime );
200  if ( $info['status'] !== false || !$job->allowRetries() ) {
201  $group->ack( $job ); // succeeded or job cannot be retried
202  }
203 
204  // Back off of certain jobs for a while (for throttling and for errors)
205  if ( $info['status'] === false && mt_rand( 0, 49 ) == 0 ) {
206  $ttw = max( $ttw, $this->getErrorBackoffTTL( $info['error'] ) );
207  $backoffDeltas[$jType] = isset( $backoffDeltas[$jType] )
208  ? $backoffDeltas[$jType] + $ttw
209  : $ttw;
210  }
211 
212  $response['jobs'][] = [
213  'type' => $jType,
214  'status' => ( $info['status'] === false ) ? 'failed' : 'ok',
215  'error' => $info['error'],
216  'time' => $info['timeMs']
217  ];
218  $timeMsTotal += $info['timeMs'];
219 
220  // Break out if we hit the job count or wall time limits...
221  if ( $maxJobs && $jobsPopped >= $maxJobs ) {
222  $response['reached'] = 'job-limit';
223  break;
224  } elseif ( $maxTime && ( microtime( true ) - $startTime ) > $maxTime ) {
225  $response['reached'] = 'time-limit';
226  break;
227  }
228 
229  // Don't let any of the main DB replica DBs get backed up.
230  // This only waits for so long before exiting and letting
231  // other wikis in the farm (on different masters) get a chance.
232  $timePassed = microtime( true ) - $lastCheckTime;
233  if ( $timePassed >= self::LAG_CHECK_PERIOD || $timePassed < 0 ) {
234  $ok = $lbFactory->waitForReplication( [ 'ifWritesSince' => $lastCheckTime ] );
235  if ( !$ok ) {
236  $response['reached'] = 'replica-lag-limit';
237  break;
238  }
239  $lastCheckTime = microtime( true );
240  }
241 
242  // Bail if near-OOM instead of in a job
243  if ( !$this->checkMemoryOK() ) {
244  $response['reached'] = 'memory-limit';
245  break;
246  }
247  }
248  } while ( $job ); // stop when there are no jobs
249 
250  // Sync the persistent backoffs for the next runJobs.php pass
251  if ( $backoffDeltas ) {
252  $this->syncBackoffDeltas( $backoffs, $backoffDeltas, 'wait' );
253  }
254 
255  $response['backoffs'] = $backoffs;
256  $response['elapsed'] = $timeMsTotal;
257 
258  return $response;
259  }
260 
265  private function getErrorBackoffTTL( $error ) {
266  return strpos( $error, 'DBReadOnlyError' ) !== false
269  }
270 
278  private function executeJob( RunnableJob $job, LBFactory $lbFactory, $stats, $popTime ) {
279  $jType = $job->getType();
280  $msg = $job->toString() . " STARTING";
281  $this->logger->debug( $msg, [
282  'job_type' => $job->getType(),
283  ] );
284  $this->debugCallback( $msg );
285 
286  // Clear out title cache data from prior snapshots
287  // (e.g. from before JobRunner was invoked in this process)
288  MediaWikiServices::getInstance()->getLinkCache()->clear();
289 
290  // Run the job...
291  $rssStart = $this->getMaxRssKb();
292  $jobStartTime = microtime( true );
293  try {
294  $fnameTrxOwner = get_class( $job ) . '::run'; // give run() outer scope
295  // Flush any pending changes left over from an implicit transaction round
296  if ( $job->hasExecutionFlag( $job::JOB_NO_EXPLICIT_TRX_ROUND ) ) {
297  $lbFactory->commitMasterChanges( $fnameTrxOwner ); // new implicit round
298  } else {
299  $lbFactory->beginMasterChanges( $fnameTrxOwner ); // new explicit round
300  }
301  // Clear any stale REPEATABLE-READ snapshots from replica DB connections
302  $lbFactory->flushReplicaSnapshots( $fnameTrxOwner );
303  $status = $job->run();
304  $error = $job->getLastError();
305  // Commit all pending changes from this job
306  $this->commitMasterChanges( $lbFactory, $job, $fnameTrxOwner );
307  // Run any deferred update tasks; doUpdates() manages transactions itself
309  } catch ( Exception $e ) {
311  $status = false;
312  $error = get_class( $e ) . ': ' . $e->getMessage();
313  }
314  // Always attempt to call teardown(), even if Job throws exception
315  try {
316  $job->tearDown( $status );
317  } catch ( Exception $e ) {
319  }
320 
321  $timeMs = intval( ( microtime( true ) - $jobStartTime ) * 1000 );
322  $rssEnd = $this->getMaxRssKb();
323 
324  // Record how long jobs wait before getting popped
325  $readyTs = $job->getReadyTimestamp();
326  if ( $readyTs ) {
327  $pickupDelay = max( 0, $popTime - $readyTs );
328  $stats->timing( 'jobqueue.pickup_delay.all', 1000 * $pickupDelay );
329  $stats->timing( "jobqueue.pickup_delay.$jType", 1000 * $pickupDelay );
330  }
331  // Record root job age for jobs being run
332  $rootTimestamp = $job->getRootJobParams()['rootJobTimestamp'];
333  if ( $rootTimestamp ) {
334  $age = max( 0, $popTime - wfTimestamp( TS_UNIX, $rootTimestamp ) );
335  $stats->timing( "jobqueue.pickup_root_age.$jType", 1000 * $age );
336  }
337  // Track the execution time for jobs
338  $stats->timing( "jobqueue.run.$jType", $timeMs );
339  // Track RSS increases for jobs (in case of memory leaks)
340  if ( $rssStart && $rssEnd ) {
341  $stats->updateCount( "jobqueue.rss_delta.$jType", $rssEnd - $rssStart );
342  }
343 
344  if ( $status === false ) {
345  $msg = $job->toString() . " t={job_duration} error={job_error}";
346  $this->logger->error( $msg, [
347  'job_type' => $job->getType(),
348  'job_duration' => $timeMs,
349  'job_error' => $error,
350  ] );
351 
352  $msg = $job->toString() . " t=$timeMs error={$error}";
353  $this->debugCallback( $msg );
354  } else {
355  $msg = $job->toString() . " t={job_duration} good";
356  $this->logger->info( $msg, [
357  'job_type' => $job->getType(),
358  'job_duration' => $timeMs,
359  ] );
360 
361  $msg = $job->toString() . " t=$timeMs good";
362  $this->debugCallback( $msg );
363  }
364 
365  return [ 'status' => $status, 'error' => $error, 'timeMs' => $timeMs ];
366  }
367 
371  private function getMaxRssKb() {
372  $info = getrusage( 0 /* RUSAGE_SELF */ );
373  // see https://linux.die.net/man/2/getrusage
374  return isset( $info['ru_maxrss'] ) ? (int)$info['ru_maxrss'] : null;
375  }
376 
382  private function getBackoffTimeToWait( RunnableJob $job ) {
383  $throttling = $this->config->get( 'JobBackoffThrottling' );
384 
385  if ( !isset( $throttling[$job->getType()] ) || $job instanceof DuplicateJob ) {
386  return 0; // not throttled
387  }
388 
389  $itemsPerSecond = $throttling[$job->getType()];
390  if ( $itemsPerSecond <= 0 ) {
391  return 0; // not throttled
392  }
393 
394  $seconds = 0;
395  if ( $job->workItemCount() > 0 ) {
396  $exactSeconds = $job->workItemCount() / $itemsPerSecond;
397  // use randomized rounding
398  $seconds = floor( $exactSeconds );
399  $remainder = $exactSeconds - $seconds;
400  $seconds += ( mt_rand() / mt_getrandmax() < $remainder ) ? 1 : 0;
401  }
402 
403  return (int)$seconds;
404  }
405 
414  private function loadBackoffs( array $backoffs, $mode = 'wait' ) {
415  $file = wfTempDir() . '/mw-runJobs-backoffs.json';
416  if ( is_file( $file ) ) {
417  $noblock = ( $mode === 'nowait' ) ? LOCK_NB : 0;
418  $handle = fopen( $file, 'rb' );
419  if ( !flock( $handle, LOCK_SH | $noblock ) ) {
420  fclose( $handle );
421  return $backoffs; // don't wait on lock
422  }
423  $content = stream_get_contents( $handle );
424  flock( $handle, LOCK_UN );
425  fclose( $handle );
426  $ctime = microtime( true );
427  $cBackoffs = json_decode( $content, true ) ?: [];
428  foreach ( $cBackoffs as $type => $timestamp ) {
429  if ( $timestamp < $ctime ) {
430  unset( $cBackoffs[$type] );
431  }
432  }
433  } else {
434  $cBackoffs = [];
435  }
436 
437  return $cBackoffs;
438  }
439 
451  private function syncBackoffDeltas( array $backoffs, array &$deltas, $mode = 'wait' ) {
452  if ( !$deltas ) {
453  return $this->loadBackoffs( $backoffs, $mode );
454  }
455 
456  $noblock = ( $mode === 'nowait' ) ? LOCK_NB : 0;
457  $file = wfTempDir() . '/mw-runJobs-backoffs.json';
458  $handle = fopen( $file, 'wb+' );
459  if ( !flock( $handle, LOCK_EX | $noblock ) ) {
460  fclose( $handle );
461  return $backoffs; // don't wait on lock
462  }
463  $ctime = microtime( true );
464  $content = stream_get_contents( $handle );
465  $cBackoffs = json_decode( $content, true ) ?: [];
466  foreach ( $deltas as $type => $seconds ) {
467  $cBackoffs[$type] = isset( $cBackoffs[$type] ) && $cBackoffs[$type] >= $ctime
468  ? $cBackoffs[$type] + $seconds
469  : $ctime + $seconds;
470  }
471  foreach ( $cBackoffs as $type => $timestamp ) {
472  if ( $timestamp < $ctime ) {
473  unset( $cBackoffs[$type] );
474  }
475  }
476  ftruncate( $handle, 0 );
477  fwrite( $handle, json_encode( $cBackoffs ) );
478  flock( $handle, LOCK_UN );
479  fclose( $handle );
480 
481  $deltas = [];
482 
483  return $cBackoffs;
484  }
485 
491  private function checkMemoryOK() {
492  static $maxBytes = null;
493  if ( $maxBytes === null ) {
494  $m = [];
495  if ( preg_match( '!^(\d+)(k|m|g|)$!i', ini_get( 'memory_limit' ), $m ) ) {
496  list( , $num, $unit ) = $m;
497  $conv = [ 'g' => 1073741824, 'm' => 1048576, 'k' => 1024, '' => 1 ];
498  $maxBytes = $num * $conv[strtolower( $unit )];
499  } else {
500  $maxBytes = 0;
501  }
502  }
503  $usedBytes = memory_get_usage();
504  if ( $maxBytes && $usedBytes >= 0.95 * $maxBytes ) {
505  $msg = "Detected excessive memory usage ({used_bytes}/{max_bytes}).";
506  $this->logger->error( $msg, [
507  'used_bytes' => $usedBytes,
508  'max_bytes' => $maxBytes,
509  ] );
510 
511  $msg = "Detected excessive memory usage ($usedBytes/$maxBytes).";
512  $this->debugCallback( $msg );
513 
514  return false;
515  }
516 
517  return true;
518  }
519 
524  private function debugCallback( $msg ) {
525  if ( $this->debug ) {
526  call_user_func_array( $this->debug, [ wfTimestamp( TS_DB ) . " $msg\n" ] );
527  }
528  }
529 
541  private function commitMasterChanges( LBFactory $lbFactory, RunnableJob $job, $fnameTrxOwner ) {
542  $syncThreshold = $this->config->get( 'JobSerialCommitThreshold' );
543 
544  $time = false;
545  $lb = $lbFactory->getMainLB();
546  if ( $syncThreshold !== false && $lb->hasStreamingReplicaServers() ) {
547  // Generally, there is one master connection to the local DB
548  $dbwSerial = $lb->getAnyOpenConnection( $lb->getWriterIndex() );
549  // We need natively blocking fast locks
550  if ( $dbwSerial && $dbwSerial->namedLocksEnqueue() ) {
551  $time = $dbwSerial->pendingWriteQueryDuration( $dbwSerial::ESTIMATE_DB_APPLY );
552  if ( $time < $syncThreshold ) {
553  $dbwSerial = false;
554  }
555  } else {
556  $dbwSerial = false;
557  }
558  } else {
559  // There are no replica DBs or writes are all to foreign DB (we don't handle that)
560  $dbwSerial = false;
561  }
562 
563  if ( !$dbwSerial ) {
564  $lbFactory->commitMasterChanges(
565  $fnameTrxOwner,
566  // Abort if any transaction was too big
567  [ 'maxWriteDuration' => $this->config->get( 'MaxJobDBWriteDuration' ) ]
568  );
569 
570  return;
571  }
572 
573  $ms = intval( 1000 * $time );
574 
575  $msg = $job->toString() . " COMMIT ENQUEUED [{job_commit_write_ms}ms of writes]";
576  $this->logger->info( $msg, [
577  'job_type' => $job->getType(),
578  'job_commit_write_ms' => $ms,
579  ] );
580 
581  $msg = $job->toString() . " COMMIT ENQUEUED [{$ms}ms of writes]";
582  $this->debugCallback( $msg );
583 
584  // Wait for an exclusive lock to commit
585  if ( !$dbwSerial->lock( 'jobrunner-serial-commit', $fnameTrxOwner, 30 ) ) {
586  // This will trigger a rollback in the main loop
587  throw new DBError( $dbwSerial, "Timed out waiting on commit queue." );
588  }
589  $unlocker = new ScopedCallback( function () use ( $dbwSerial, $fnameTrxOwner ) {
590  $dbwSerial->unlock( 'jobrunner-serial-commit', $fnameTrxOwner );
591  } );
592 
593  // Wait for the replica DBs to catch up
594  $pos = $lb->getMasterPos();
595  if ( $pos ) {
596  $lb->waitForAll( $pos );
597  }
598 
599  // Actually commit the DB master changes
600  $lbFactory->commitMasterChanges(
601  $fnameTrxOwner,
602  // Abort if any transaction was too big
603  [ 'maxWriteDuration' => $this->config->get( 'MaxJobDBWriteDuration' ) ]
604  );
605  ScopedCallback::consume( $unlocker );
606  }
607 }
JobQueueGroup\USE_CACHE
const USE_CACHE
Definition: JobQueueGroup.php:50
JobRunner\ERROR_BACKOFF_TTL
const ERROR_BACKOFF_TTL
Definition: JobRunner.php:52
JobRunner\$logger
LoggerInterface $logger
Definition: JobRunner.php:48
$response
$response
Definition: opensearch_desc.php:38
Profiler\instance
static instance()
Singleton.
Definition: Profiler.php:63
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:129
JobRunner\__construct
__construct(LoggerInterface $logger=null)
Definition: JobRunner.php:73
JobQueueGroup\TYPE_DEFAULT
const TYPE_DEFAULT
Definition: JobQueueGroup.php:47
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1871
RunnableJob
Job that has a run() method and metadata accessors for JobQueue::pop() and JobQueue::ack()
Definition: RunnableJob.php:35
$file
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition: router.php:42
wfReadOnly
wfReadOnly()
Check whether the wiki is in read-only mode.
Definition: GlobalFunctions.php:1170
JobRunner\getBackoffTimeToWait
getBackoffTimeToWait(RunnableJob $job)
Definition: JobRunner.php:382
Wikimedia\Rdbms\LBFactory\flushReplicaSnapshots
flushReplicaSnapshots( $fname=__METHOD__)
Commit all replica DB transactions so as to flush any REPEATABLE-READ or SSI snapshot.
Definition: LBFactory.php:217
Wikimedia\Rdbms\ILBFactory\getMainLB
getMainLB( $domain=false)
Get a cached (tracked) load balancer object.
Wikimedia\Rdbms\DBError
Database error base class.
Definition: DBError.php:30
Wikimedia\Rdbms\LBFactory\commitMasterChanges
commitMasterChanges( $fname=__METHOD__, array $options=[])
Commit changes and clear view snapshots on all master connections.
Definition: LBFactory.php:251
JobRunner\syncBackoffDeltas
syncBackoffDeltas(array $backoffs, array &$deltas, $mode='wait')
Merge the current backoff expiries from persistent storage.
Definition: JobRunner.php:451
Config
Interface for configuration instances.
Definition: Config.php:28
JobRunner\setLogger
setLogger(LoggerInterface $logger)
Definition: JobRunner.php:66
JobRunner\READONLY_BACKOFF_TTL
const READONLY_BACKOFF_TTL
Definition: JobRunner.php:53
MediaWiki\Logger\LoggerFactory
PSR-3 logger instance factory.
Definition: LoggerFactory.php:45
JobRunner\debugCallback
debugCallback( $msg)
Log the job message.
Definition: JobRunner.php:524
MWExceptionHandler\rollbackMasterChangesAndLog
static rollbackMasterChangesAndLog( $e)
Roll back any open database transactions and log the stack trace of the exception.
Definition: MWExceptionHandler.php:121
JobRunner\run
run(array $options)
Run jobs of the specified number/type for the specified time.
Definition: JobRunner.php:105
JobRunner\LAG_CHECK_PERIOD
const LAG_CHECK_PERIOD
Definition: JobRunner.php:51
JobRunner\loadBackoffs
loadBackoffs(array $backoffs, $mode='wait')
Get the previous backoff expiries from persistent storage On I/O or lock acquisition failure this ret...
Definition: JobRunner.php:414
DuplicateJob
No-op job that does nothing.
Definition: DuplicateJob.php:29
JobRunner\commitMasterChanges
commitMasterChanges(LBFactory $lbFactory, RunnableJob $job, $fnameTrxOwner)
Issue a commit on all masters who are currently in a transaction and have made changes to the databas...
Definition: JobRunner.php:541
JobRunner\executeJob
executeJob(RunnableJob $job, LBFactory $lbFactory, $stats, $popTime)
Definition: JobRunner.php:278
JobRunner\setDebugHandler
setDebugHandler( $debug)
Definition: JobRunner.php:58
$content
$content
Definition: router.php:78
JobRunner\$debug
callable null $debug
Debug output handler.
Definition: JobRunner.php:43
DeferredUpdates\doUpdates
static doUpdates( $mode='run', $stage=self::ALL)
Do any deferred updates and clear the list.
Definition: DeferredUpdates.php:140
Wikimedia\Rdbms\LBFactory\beginMasterChanges
beginMasterChanges( $fname=__METHOD__)
Flush any master transaction snapshots and set DBO_TRX (if DBO_DEFAULT is set)
Definition: LBFactory.php:233
JobRunner\getMaxRssKb
getMaxRssKb()
Definition: JobRunner.php:371
wfTempDir
wfTempDir()
Tries to get the system directory for temporary files.
Definition: GlobalFunctions.php:1949
JobQueueGroup\singleton
static singleton( $domain=false)
Definition: JobQueueGroup.php:70
JobRunner\$config
Config $config
Definition: JobRunner.php:41
$job
if(count( $args)< 1) $job
Definition: recompressTracked.php:50
Wikimedia\Rdbms\LBFactory
An interface for generating database load balancers.
Definition: LBFactory.php:40
JobRunner\MAX_ALLOWED_LAG
const MAX_ALLOWED_LAG
Definition: JobRunner.php:50
JobRunner
Job queue runner utility methods.
Definition: JobRunner.php:39
WebRequest\overrideRequestId
static overrideRequestId( $id)
Override the unique request ID.
Definition: WebRequest.php:336
JobRunner\getErrorBackoffTTL
getErrorBackoffTTL( $error)
Definition: JobRunner.php:265
JobRunner\checkMemoryOK
checkMemoryOK()
Make sure that this script is not too close to the memory usage limit.
Definition: JobRunner.php:491
$type
$type
Definition: testCompression.php:50
MWExceptionHandler\logException
static logException( $e, $catcher=self::CAUGHT_BY_OTHER, $extraData=[])
Log an exception to the exception log (if enabled).
Definition: MWExceptionHandler.php:629