MediaWiki
1.30.0
|
Job queue runner utility methods. More...
Public Member Functions | |
__construct (LoggerInterface $logger=null) | |
run (array $options) | |
Run jobs of the specified number/type for the specified time. More... | |
setDebugHandler ( $debug) | |
setLogger (LoggerInterface $logger) | |
Public Attributes | |
const | ERROR_BACKOFF_TTL = 1 |
const | LAG_CHECK_PERIOD = 1.0 |
const | MAX_ALLOWED_LAG = 3 |
const | READONLY_BACKOFF_TTL = 30 |
Protected Attributes | |
Config | $config |
callable null | $debug |
Debug output handler. More... | |
$logger | |
Private Member Functions | |
checkMemoryOK () | |
Make sure that this script is not too close to the memory usage limit. More... | |
commitMasterChanges (LBFactory $lbFactory, Job $job, $fnameTrxOwner) | |
Issue a commit on all masters who are currently in a transaction and have made changes to the database. More... | |
debugCallback ( $msg) | |
Log the job message. More... | |
executeJob (Job $job, LBFactory $lbFactory, $stats, $popTime) | |
getBackoffTimeToWait (Job $job) | |
getErrorBackoffTTL ( $error) | |
getMaxRssKb () | |
loadBackoffs (array $backoffs, $mode='wait') | |
Get the previous backoff expiries from persistent storage On I/O or lock acquisition failure this returns the original $backoffs. More... | |
syncBackoffDeltas (array $backoffs, array &$deltas, $mode='wait') | |
Merge the current backoff expiries from persistent storage. More... | |
JobRunner::__construct | ( | LoggerInterface | $logger = null | ) |
LoggerInterface | $logger |
Definition at line 74 of file JobRunner.php.
References $logger, and setLogger().
|
private |
Make sure that this script is not too close to the memory usage limit.
It is better to die in between jobs than OOM right in the middle of one.
Definition at line 490 of file JobRunner.php.
References debugCallback(), and list.
Referenced by run().
Issue a commit on all masters who are currently in a transaction and have made changes to the database.
It also supports sometimes waiting for the local wiki's replica DBs to catch up. See the documentation for $wgJobSerialCommitThreshold for more.
LBFactory | $lbFactory | |
Job | $job | |
string | $fnameTrxOwner |
DBError |
Definition at line 540 of file JobRunner.php.
References $job, $time, Wikimedia\Rdbms\LBFactory\commitMasterChanges(), debugCallback(), Wikimedia\Rdbms\LBFactory\getMainLB(), use, and wfWikiID().
Referenced by executeJob().
|
private |
Log the job message.
string | $msg | The message to log |
Definition at line 523 of file JobRunner.php.
References wfTimestamp().
Referenced by checkMemoryOK(), commitMasterChanges(), and executeJob().
Job | $job | |
LBFactory | $lbFactory | |
StatsdDataFactory | $stats | |
float | $popTime |
Definition at line 281 of file JobRunner.php.
References $e, $job, DeferredUpdates\addCallableUpdate(), Wikimedia\Rdbms\LBFactory\beginMasterChanges(), class, commitMasterChanges(), debugCallback(), DeferredUpdates\doUpdates(), Wikimedia\Rdbms\LBFactory\flushReplicaSnapshots(), getMaxRssKb(), MWExceptionHandler\logException(), MWExceptionHandler\rollbackMasterChangesAndLog(), and wfTimestamp().
Referenced by run().
|
private |
Job | $job |
Definition at line 381 of file JobRunner.php.
References $job.
Referenced by run().
|
private |
string | $error |
Definition at line 268 of file JobRunner.php.
References ERROR_BACKOFF_TTL, and READONLY_BACKOFF_TTL.
Referenced by run().
|
private |
Definition at line 370 of file JobRunner.php.
References wfGetRusage().
Referenced by executeJob().
|
private |
Get the previous backoff expiries from persistent storage On I/O or lock acquisition failure this returns the original $backoffs.
array | $backoffs | Map of (job type => UNIX timestamp) |
string | $mode | Lock wait mode - "wait" or "nowait" |
Definition at line 413 of file JobRunner.php.
References $type, as, and wfTempDir().
Referenced by syncBackoffDeltas().
JobRunner::run | ( | array | $options | ) |
Run jobs of the specified number/type for the specified time.
The response map has a 'job' field that lists status of each job, including:
This method outputs status information only if a debug handler was set. Any exceptions are caught and logged, but are not reported as output.
array | $options | Map of parameters:
|
Definition at line 106 of file JobRunner.php.
References $e, $job, $options, $response, $type, $wait, checkMemoryOK(), executeJob(), false, getBackoffTimeToWait(), getErrorBackoffTTL(), Profiler\instance(), list, WebRequest\overrideRequestId(), JobQueueGroup\singleton(), syncBackoffDeltas(), JobQueueGroup\TYPE_DEFAULT, JobQueueGroup\USE_CACHE, wfReadOnly(), and wfWikiID().
JobRunner::setDebugHandler | ( | $debug | ) |
callable | $debug | Optional debug output handler |
Definition at line 59 of file JobRunner.php.
References $debug.
JobRunner::setLogger | ( | LoggerInterface | $logger | ) |
LoggerInterface | $logger |
Definition at line 67 of file JobRunner.php.
References $logger.
Referenced by __construct().
Merge the current backoff expiries from persistent storage.
The $deltas map is set to an empty array on success. On I/O or lock acquisition failure this returns the original $backoffs.
array | $backoffs | Map of (job type => UNIX timestamp) |
array | $deltas | Map of (job type => seconds) |
string | $mode | Lock wait mode - "wait" or "nowait" |
Definition at line 450 of file JobRunner.php.
References $type, as, loadBackoffs(), and wfTempDir().
Referenced by run().
|
protected |
Definition at line 42 of file JobRunner.php.
|
protected |
|
protected |
Definition at line 49 of file JobRunner.php.
Referenced by __construct(), and setLogger().
const JobRunner::ERROR_BACKOFF_TTL = 1 |
Definition at line 53 of file JobRunner.php.
Referenced by getErrorBackoffTTL().
const JobRunner::LAG_CHECK_PERIOD = 1.0 |
Definition at line 52 of file JobRunner.php.
const JobRunner::MAX_ALLOWED_LAG = 3 |
Definition at line 51 of file JobRunner.php.
const JobRunner::READONLY_BACKOFF_TTL = 30 |
Definition at line 54 of file JobRunner.php.
Referenced by getErrorBackoffTTL().