mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-23 23:44:53 +00:00
NotificationJob: make sure we retry to load the event from master
EventMapper->fetchById() has retry on master built-in but it doesn't kick in in a Job because the load balancer is a new instance and doesn't know about previous writes. This change makes the job always read from master to make sure the event is found. It is going to write to master right after anyway. Bug: T204894 Change-Id: I9a2873234f1dd5416e6c2bedeb904880d1f79562
This commit is contained in:
parent
2256c03253
commit
f361425a34
|
@ -1,17 +1,14 @@
|
|||
<?php
|
||||
|
||||
class EchoNotificationJob extends Job {
|
||||
/** @var int */
|
||||
private $eventId;
|
||||
|
||||
public function __construct( $title, $params ) {
|
||||
parent::__construct( 'EchoNotificationJob', $title, $params );
|
||||
$this->eventId = $params['eventId'];
|
||||
}
|
||||
|
||||
public function run() {
|
||||
MWEchoDbFactory::newFromDefault()->waitForSlaves();
|
||||
$event = EchoEvent::newFromID( $this->eventId );
|
||||
$eventMapper = new EchoEventMapper();
|
||||
$event = $eventMapper->fetchById( $this->params['eventId'], true );
|
||||
EchoNotificationController::notify( $event, false );
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue