Comment has been collapsed.
Don't ask me, I'm just linking the related announcement.
Comment has been collapsed.
I think I know why. If the user resets his unread messages, then he receives some more new messages but some of the old replies to his messages get deleted, the number gets subtracted from his new messages and the value would be incorrect.
This can be easily solved by also storing in the cache the last reset date and decrementing the cache depending on the last reset date.
So, if the last reset date for userX is an hour ago and userY deletes his reply to userX from yesterday the cache is not decremented for userX. But if the same userY deletes the message he posted as a reply to userX after the last reset date for userX, the cache gets decremented by one for userX.
I'll simply ignore the negligible race condition that can appear due to non-atomic execution.
But, all in all, that fixes the problem without having any overhead.
Comment has been collapsed.
My understanding is cg tried to avoid cross-checking with the db and did it at the cache level. When userX gets a message, the cache field for userX gets incremented by one. When userX marks his messages as read, his unread messages cache field gets reset.
So this bypasses the database completely but only when checking how many unread messages userX has, when the value is taken from cache instead of the database.
Comment has been collapsed.
You might want to post that into the announcement thread
Good idea. Posted a link into the announcement thread as well.
Comment has been collapsed.
So it was a deliberate choice. Thanks for pointing out that thread.
Comment has been collapsed.
And does it really matter that much? I always thought it was kind of useful actually.
Comment has been collapsed.
8 Comments - Last post 16 minutes ago by szacsoka
0 Comments - Created 32 minutes ago by pb1
16,403 Comments - Last post 32 minutes ago by MLD
47,139 Comments - Last post 38 minutes ago by kbronct
31 Comments - Last post 57 minutes ago by NoctuaVentus
20 Comments - Last post 1 hour ago by OneManArmyStar
1,952 Comments - Last post 2 hours ago by Ashtart
901 Comments - Last post 24 seconds ago by Lugum
50 Comments - Last post 38 seconds ago by BHTrellis188
755 Comments - Last post 5 minutes ago by alexfirehouse
269 Comments - Last post 6 minutes ago by Dinoshu
39 Comments - Last post 47 minutes ago by ChrisKutcher
6,950 Comments - Last post 57 minutes ago by stabilo102
2,097 Comments - Last post 1 hour ago by Pebbletool
I just noticed a bug on the site.
When someone replies to one of your messages and then deletes the reply, the deleted message won't appear on the messages page (obviously) but it gets taken into consideration for the new messages notification.
Therefore, the displayed number of new messages is wrong because it takes into account the deleted ones too even if they're not available anymore.
Example:
As you can see from the picture, there are only two new messages available, but three new messages reported.
Comment has been collapsed.