Merge "NotifUser: Remove $dbSource parameter from resetNotificationCount()"

This commit is contained in:
jenkins-bot 2018-06-02 17:11:34 +00:00 committed by Gerrit Code Review
commit ffa6922558
2 changed files with 3 additions and 9 deletions

View file

@ -412,12 +412,8 @@ class MWEchoNotifUser {
*
* NOTE: Consider calling this function from a deferred update, since it will read from and write to
* the master DB if cross-wiki notifications are enabled.
*
* @param int $dbSource Use master or replica database to pull count.
* Only used if $wgEchoCrossWikiNotifications is enabled.
* Do not set this to DB_REPLICA unless you know what you're doing.
*/
public function resetNotificationCount( $dbSource = DB_MASTER ) {
public function resetNotificationCount() {
global $wgEchoCrossWikiNotifications;
// Delete cached local counts and timestamps
@ -437,7 +433,7 @@ class MWEchoNotifUser {
$uw = EchoUnreadWikis::newFromUser( $this->mUser );
if ( $uw ) {
// Immediately compute new local counts and timestamps
$newLocalData = $this->computeLocalCountsAndTimestamps( $dbSource );
$newLocalData = $this->computeLocalCountsAndTimestamps( DB_MASTER );
// Write the new values to the echo_unread_wikis table
$alertTs = $newLocalData[EchoAttributeManager::ALERT]['timestamp'];
$messageTs = $newLocalData[EchoAttributeManager::MESSAGE]['timestamp'];

View file

@ -34,9 +34,7 @@ class EchoModerationController {
// users whose notifications have been moderated.
foreach ( $affectedUserIds as $userId ) {
$user = User::newFromId( $userId );
// TODO this looks like it's still susceptible to a race condition, if the notification count
// was reset from the master just before
MWEchoNotifUser::newFromUser( $user )->resetNotificationCount( DB_REPLICA );
MWEchoNotifUser::newFromUser( $user )->resetNotificationCount();
}
} );
}