There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

athlon ,

Ok, so basically, there is multiple ways one could comment count. The most obvious option is to count the actual number of comments under the post. This might be in practice slow, as you must load all comments under the post. An alternative approach is to have a count variable for post, which is increased or decreased by 1 if post is added/removed. It’s way faster to retrieve that variable, instead of getting all comments and counting the number of them. The problem starts if some anomaly happens that is not accounted for, so for example, if I request the same comment to be deleted multiple times. So that counter can be decreased more than once for the same comment. This could be fixed pretty easily:


<span style="color:#323232;">if comment_to_delete is deleted {
</span><span style="color:#323232;">	// Do not do anything
</span><span style="color:#323232;">	return
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="color:#323232;">post.comment_count -= 1
</span><span style="color:#323232;">delete_comment(comment_to_delete)
</span>

And yeah, I thought so too, but ever since I stumbled upon this bug, I think the way the comment count is stored is through the counter variable.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • [email protected]
  • lifeLocal
  • goranko
  • All magazines