mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-18 02:40:50 +00:00
ec18d637b9
This is in case job queue is picking up the job too fast when the current transaction is not completed and job queue is trying to access non-committed data When job is popped, some of the object is re-initialized from the database, this will handle the replication lag Change-Id: Ia7debb4db0103f27a3e326beb52db0f63bc7c0bc
21 lines
593 B
PHP
21 lines
593 B
PHP
<?php
|
|
|
|
class EchoNotificationJob extends Job {
|
|
function __construct( $title, $params ) {
|
|
parent::__construct( 'EchoNotificationJob', $title, $params );
|
|
$this->event = $params['event'];
|
|
}
|
|
|
|
function run() {
|
|
if ( !empty( $this->params['mainDbMasterPos'] ) ) {
|
|
wfGetLB()->waitFor( $this->params['mainDbMasterPos'] );
|
|
}
|
|
if ( !empty( $this->params['echoDbMasterPos'] ) ) {
|
|
global $wgEchoCluster;
|
|
wfGetLBFactory()->getExternalLB( $wgEchoCluster )->waitFor( $this->params['echoDbMasterPos'] );
|
|
}
|
|
EchoNotificationController::notify( $this->event, false );
|
|
return true;
|
|
}
|
|
}
|