Incorrect "new comments" count January 20, 2005 2:12 PM   Subscribe

MeFi posts show incorrect number of "new comments" on main page next to the number of comments link to the discussion itself.
posted by odinsdream to Bugs at 2:12 PM (8 comments total)

Sorry if this was already posted. It's a hard item to search for, and I came up empty-handed. The number of posts shown as New seems to have no clue as to when I last viewed the thread. What is this number based on?
posted by odinsdream at 2:13 PM on January 20, 2005

Same problem here.
posted by ThePinkSuperhero at 2:24 PM on January 20, 2005 [1 favorite]

I have this problem as well. It seems to be at least partially related to closing my browser, though that doesn't always work.
posted by trey at 2:33 PM on January 20, 2005

Oh, I should add: Firefox 1.0 / WinXP.
posted by trey at 2:34 PM on January 20, 2005

I assume the table of last visits is updated periodically, and not in real time.
posted by Gyan at 2:47 PM on January 20, 2005

Gyan, I would have guessed it was a session cookie that stored the viewing time of each post, and used that to count how many comments were added to each post since that time.

While the number is usually wrong, it is also usually different on different computers. So, at work, it isn't always right, but when I get home, all the threads have (X new) on them, since I haven't visited any of the threads on that computer.
posted by odinsdream at 3:25 PM on January 20, 2005

As far as I can tell, it is not based on the last time you viewed a certain thread. Since threads I don't care about don't always show "n comments (n new)", plus the header "There have been m links and p comments posted since your last visit" implies that it's per-visit to the site.

Better yet, it seems like it has to be >x minutes since your last visit to the site for your cookie to get reset. That way, a single "visit" that involves back-and-forths to the front page doesn't bork.

(I implimented cookie-based 'new comments' counts once. It was surprisingly tough to get right.)
posted by Plutor at 3:51 PM on January 20, 2005

It's a session variable and it's supposed to work like so:

You hit mefi for the first time since yesterday. A script checks the timestamp on yesterday and stores that as a session variable. Then it grabs the current time (now) and puts that into the database, replacing your timestamp of yesterday. All queries work off the session variable.

Now, in order for that session variable to die, and for your next visit to reference your previous visit today, you need to stay away from loading any page for 20 minutes. If you check the site more often than that, it will never be updated, and continue to use yesterday's date.

These should all be keyed off the database, and not a cookie, so I don't know why you are getting different counts on different computers, other than it is taking more than 20 minutes to move from one computer to the next.
posted by mathowie (staff) at 3:56 PM on January 20, 2005

« Older Mefites by Occupation [broken]   |   Too Much MetAskMe Newer »

You are not logged in, either login or create an account to post comments