Page MenuHomePhabricator

Display correct number of notifications
Closed, ResolvedPublic

Description

As can be seen in the screenshot, the total number of unread notifications on Wikidata is given to me as 100, but the number for Q229883 (the item with the highest activity) is given as 386, which indicates that the 100 is probably wrong.

My suspicion is that the 386 may also be off - even by one or two orders of magnitude. The reason I am suspecting this is that a few days ago, that number stood at about 2000, and I have since not gone and looked at more than a few single relevant diffs, while notifications relating to Q229883 have kept coming in in great numbers due to a series of WIDAR edits by another user.

I took some more screenshots over the last few days in case past numbers become relevant.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 5 2016, 2:28 AM
Restricted Application added a project: Collaboration-Team-Triage. · View Herald TranscriptSep 5 2016, 3:41 AM

Another indication that at least the numbers for Wikidata total and for Q229883 are wrong: the first hasn't changed since I posted this ticket, while the second has gone down, despite new notifications for it coming in by the second.

See fresh screenshot.

As Stephane said, this appears to be because we use capped notification counts inconsistently, and also don't use messages that understand that "100" means "99+" in these places.

Also note that 2000 is a magic number: it's the maximum number of notifications you can have. This may be why the number of notifications for Q229883 is going down: the old ones are being deleted as new notifications (associated with different pages) arrive.

SBisson added a subscriber: SBisson.Sep 9 2016, 2:23 PM

Change 309620 had a related patch set uploaded (by Mooeypoo):
Use echo-badge-count message for cross-wiki counts in Special:Notifications

https://gerrit.wikimedia.org/r/309620

Mooeypoo claimed this task.Sep 9 2016, 8:14 PM
Mooeypoo moved this task from Untriaged to QA Review on the Collab-Team-Q1-July-Sep-2016 board.

Change 309620 merged by jenkins-bot:
Use echo-badge-count message for cross-wiki counts in Special:Notifications

https://gerrit.wikimedia.org/r/309620

Change 309677 had a related patch set uploaded (by Mooeypoo):
"Flatten" wiki notif number in the Special:Notifications page

https://gerrit.wikimedia.org/r/309677

Change 309699 had a related patch set uploaded (by Mooeypoo):
Always cap notification count based on MWEchoNotifUser::MAX_BADGE_COUNT

https://gerrit.wikimedia.org/r/309699

As Stephane said, this appears to be because we use capped notification counts inconsistently, and also don't use messages that understand that "100" means "99+" in these places.

Yes, making that more consistent would be useful.
Just FYI, I am currently standing at 104 - not sure what the cap is.

Also note that 2000 is a magic number: it's the maximum number of notifications you can have. This may be why the number of notifications for Q229883 is going down: the old ones are being deleted as new notifications (associated with different pages) arrive.

This makes sense - thanks for bringing some light into the matter. However, the maximum I have seen was 2001, not 2000.

As Stephane said, this appears to be because we use capped notification counts inconsistently, and also don't use messages that understand that "100" means "99+" in these places.

Yes, making that more consistent would be useful.
Just FYI, I am currently standing at 104 - not sure what the cap is.

We found out that what was happening is that sometimes, we'd take two capped numbers (each capped at 100) and sum them, without capping that number again. So if you had 4 alerts and 230 messages, we would tell you you had 104 (4+100) notifications. https://gerrit.wikimedia.org/r/309699 (which I'm about to merge) should fix this.

Also note that 2000 is a magic number: it's the maximum number of notifications you can have. This may be why the number of notifications for Q229883 is going down: the old ones are being deleted as new notifications (associated with different pages) arrive.

This makes sense - thanks for bringing some light into the matter. However, the maximum I have seen was 2001, not 2000.

It's possible that it does something like "if this is the 2001st notification, schedule a job to delete the excess ones later", in which case you'd see 2001 briefly.

Change 309699 merged by jenkins-bot:
Always cap notification count based on MWEchoNotifUser::MAX_BADGE_COUNT

https://gerrit.wikimedia.org/r/309699

Change 310129 had a related patch set uploaded (by Mooeypoo):
Generalize getCapptedNotificationCount and move to counter

https://gerrit.wikimedia.org/r/310129

Change 309677 abandoned by Mooeypoo:
"Flatten" wiki notif number in the Special:Notifications page

Reason:
This is now being dealt with in the back-end.

https://gerrit.wikimedia.org/r/309677

Change 310171 had a related patch set uploaded (by Mooeypoo):
Allow for count cap display in Special:Notifications sidebar

https://gerrit.wikimedia.org/r/310171

Change 310129 merged by jenkins-bot:
Generalize getCappedNotificationCount and move to counter

https://gerrit.wikimedia.org/r/310129

Change 310171 merged by jenkins-bot:
Allow for count cap display in Special:Notifications sidebar

https://gerrit.wikimedia.org/r/310171

Checked in betalabs - '99+' is correctly displayed in the badge and on Special:Notifications page.

(1) With '99+' implemented to be displayed as a cap in the side bar, there is no more discrepancy between what's displayed as a sum of unread notifications (in the wiki title) and the actual sum of unread notifications on wiki pages.
(2)

[...] the maximum I have seen was 2001, not 2000.

Checked locally - 2,001 is displayed.


(3)
If more messages are added to the previously displayed 2001, the oldest messages will be removed. echo_notification table will always store not more than 2001.

jmatazzoni closed this task as Resolved.Sep 29 2016, 11:24 PM