diff options
Diffstat (limited to 'Echo/includes/jobs/NotificationJob.php')
-rw-r--r-- | Echo/includes/jobs/NotificationJob.php | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/Echo/includes/jobs/NotificationJob.php b/Echo/includes/jobs/NotificationJob.php index a736d3d3..00282c00 100644 --- a/Echo/includes/jobs/NotificationJob.php +++ b/Echo/includes/jobs/NotificationJob.php @@ -1,43 +1,18 @@ <?php class EchoNotificationJob extends Job { + private $eventId; + function __construct( $title, $params ) { parent::__construct( 'EchoNotificationJob', $title, $params ); - $this->event = $params['event']; + $this->eventId = $params['eventId']; } function run() { - // back compat for jobs still in queue, new jobs - // masterPos is always set. remove after deploy. - if ( isset( $this->params['masterPos'] ) ) { - $masterPos = $this->params['masterPos']; - } else { - $masterPos = $this->getMasterPosition(); - } - - MWEchoDbFactory::newFromDefault()->waitFor( $masterPos ); - EchoNotificationController::notify( $this->event, false ); + MWEchoDbFactory::newFromDefault()->waitForSlaves(); + $event = EchoEvent::newFromID( $this->eventId ); + EchoNotificationController::notify( $event, false ); return true; } - - /** - * back compat detects masterPos from prior job params - * - * @return array - */ - function getMasterPosition() { - $masterPos = [ - 'wikiDb' => false, - 'echoDb' => false, - ]; - if ( !empty( $this->params['mainDbMasterPos'] ) ) { - $masterPos['wikiDb'] = $this->params['mainDbMasterPos']; - } - if ( !empty( $this->params['echoDbMasterPos'] ) ) { - $masterPos['echoDb'] = $this->params['echoDbMasterPos']; - } - - return $masterPos; - } } |