221
submitted 1 year ago by br3d@lemmy.world to c/fediverse@lemmy.world
all 50 comments
sorted by: hot top controversial new old
[-] Mininux@sh.itjust.works 123 points 1 year ago

There is the same problem on reddit, so they brought it here too so new users won't be disoriented (/s)

[-] Entheon@lemmy.world 22 points 1 year ago

Didn't that have something to do with shadow bans on Reddit?

[-] XEAL@lemm.ee 20 points 1 year ago

Or comments pending of mod approval.

[-] baronvonj@lemmy.world 5 points 1 year ago

I mod a few communities and haven't seen anything relating to comments pending mod approval. The only related setting I have on the communities is to restrict posting to moderators (comments on the posts should still be open to anyone).

[-] visor841@lemmy.world 5 points 1 year ago

It's pretty easy to see on r/askeconomics. All top-level comments there require mod approval, but will add to the number of comments while waiting for approval. So it's pretty common to see posts with 10+ comments listed, but nothing besides the pinned automod comment is visible.

[-] baronvonj@lemmy.world 2 points 1 year ago

Oh you meant on Reddit. I was talking about here on Lemmy we don't have anything like that.

[-] the_dopamine_fiend@lemmy.world 83 points 1 year ago

Are you and OP on the same instance? If not, the phantom comment could be from an instance federated with theirs but not yours.

[-] athlon@lemm.ee 18 points 1 year ago

I accidentally made a post that has -3 comments.

This happens because Lemmy does not count the actual number of comments that there are under the post, but instead there is a counter per post. This is not necessarily a bad thing, but it does not seem like the counter is every synced with the actual count of comments.

[-] Mr_Buscemi@lemmy.blahaj.zone 4 points 1 year ago

I think I noticed that if a commenter deleted their comment then the total comments would go down by 1. On a post with only one comment that also got deleted, it made it show as -1 comments.

[-] PeleSpirit@lemmy.world 2 points 1 year ago

What does counter per post mean?

Also, I always thought that was because they have to "call home" to get updated and there's time in between.

[-] athlon@lemm.ee 4 points 1 year ago

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:

if comment_to_delete is deleted {
	// Do not do anything
	return
}

post.comment_count -= 1
delete_comment(comment_to_delete)

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.

[-] PeleSpirit@lemmy.world 2 points 1 year ago

I'm sorry, I'm not really understanding since I'm not techy. Are you saying it counts how many are added or removed, not the total amount? I don't understand the difference or why that would be easier to pull info from.

[-] density@kbin.social 5 points 1 year ago

because when you load any page listing posts, you don't want your server to have to go and download the actual entire comment thread for every post that is listed. And then have to go and count how many there are.

Because it would be slow, especially with multiple servers involved. Every time you loaded your home page or a community the server would have to start from scratch gathering the data. It would be more accurate but it would be very hard. And not give a lot of extra value.

So it's more efficient to have a piece of data attached to the post that just reports the number of comments. Same way as there is a piece of data that contains the title, the name of the person who posted it etc. And that value is updated in some way. Apparently in a way that has not yet been perfected. :)

[-] PeleSpirit@lemmy.world 5 points 1 year ago

I appreciate your patience, I updated my previous comment, I think I finally get what you're saying.

[-] athlon@lemm.ee 4 points 1 year ago

Getting the total number of all comments may be very resource heavy if there is a lot of comments.

If it's just 5 comments, then the computer can quickly get them all from database and count how many of them are there. Now imagine if there is 50 000 comments and suddenly, you me and entire website ask "how many comments are there for this post?"

Suddenly the computer is overwhelmed by the request and you may end up crashing it due to amount of tasks it has to do.

It's way faster if instead of all of that, the computer kept track of a number of all comments and simply adjust it when comment is added or removed. It does not have to get all the comments and count how many are there, just simply return the number and you are done.

But in the essence, you sacriface potential accuracy for speed. You may accidentally "desynchronize" the counter - if an user requests a removal of the same comment twice, and you don't check if that comment was not removed. Or, in theory, if two separate users add or remove a comment at the same time. This is called "race condition", which is common in multi-threaded computing.

[-] PeleSpirit@lemmy.world 1 points 1 year ago

Okay, is it because I haven't had my coffee yet?

First line:

Getting the total number of all comments may be very resource heavy if there is a lot of comments.

Fourth paragraph:

It’s way faster if instead of all of that, the computer kept track of a number of all comments and simply adjust it when comment is added or removed. It does not have to get all the comments and count how many are there, just simply return the number and you are done.

What is the difference between the bolded parts?

[-] athlon@lemm.ee 3 points 1 year ago

First method does not store the number itself anywhere. Let's assume that you store apples. I come and ask you "How many apples do you have?". To answer, you go and count every single apple one by one and return me the number. It's very easy if you have a small number of apples, but if you have, let's say, 5000 apples - you can see how long it may take.

Second option is you keeping a track of how many apples you have in stock by having it written down somewhere. If I ask you "How many apples do you have?" you just pull out your notepad and tell me the number. If you give me an apple, you just adjust the number you have written down already.

[-] PeleSpirit@lemmy.world 1 points 1 year ago* (last edited 1 year ago)

Okay, I swear I almost have it. Where does the stock number come from? Does it regularly pull a number instead of counting, is that the difference? I think what you're saying is, instead of it checking live, it has a total number taken every so often. Yes?

Edit: Okay I get it, except for where my initial count comes from. I guess it starts at 0?

  • First way, constantly checking the number of comments and just goes off of that.
  • Second way, stores the number 0 at first and then only updates when a comment is added or removed.

Am I ready for my certificate yet? Yikes. Thanks for going slow, lol.

[-] athlon@lemm.ee 3 points 1 year ago

No, you just update the number whenever you make any changes to how many apples you have.

[-] baronvonj@lemmy.world 1 points 1 year ago

I had also read that editing a comment increases the comment count on a post.

[-] C4d@lemmy.world 36 points 1 year ago

Have you disabled viewing posts from bot accounts? It’s one of the user settings.

If you have disabled viewing posts from bots, this is what you would see if a bot commented.

[-] Aux@lemmy.world 33 points 1 year ago

Because data synchronisation between instances is quite poor.

[-] DavyJones@lemmy.dbzer0.com 13 points 1 year ago

Rather imperfect than poor.

[-] masterairmagic@sh.itjust.works 23 points 1 year ago

This could be due to federation. Maybe they.are federating with servers that you aren't.

But Reddit also had a lot of this and people always blamed shadowbans.

[-] density@kbin.social 4 points 1 year ago

comments removed by mods would always show up in the count.

idk why they didn't just fix that, it made people crazy for no reason.

[-] Carighan@lemmy.world 14 points 1 year ago

It's a distributed system, by its very nature no single universal "truth" exists. That is to say, you can very much see differing counts of ~anything. Or different threads. Or anything, really. There is no way to keep everything consistent, ever.

[-] redballooon@lemm.ee 12 points 1 year ago

Do you have a client that shows top comments with a time frame like “last 6 hours”? Maybe the comment is older than that.

[-] r00ty@kbin.life 6 points 1 year ago

I doubt it is a federation issue. The number of comments will be worked out by the number of comments in the local DB. So the count won't include comments not received.

As to why they're not showing, as mentioned above, hiding bot comments, or perhaps deleted comments still appear in totals (not sure about lemmy, on kbin deleted comments have their text changed to indicate they were deleted).

[-] Kolanaki@yiffit.net 11 points 1 year ago* (last edited 1 year ago)

Being the only person on my instance subscribed to certain communities on other instances, I am pretty sure it is a federation issue. When I look at the comment counts for the same post on two different instance accounts, they are not the same. They often share the same comments, but not all of them. Sometimes the number shown below the post reflects only the comments from the instance you're viewing it on, sometimes it shows all of them.

For example, looking at the Baldur's Gate 3 community on Lemmy World when logged on to Lemmy World, the top post has about 36 comments but counting them in the post there are only 30. 3 of those comments are mine, and they aren't being shown to my Lemmy World account. When I view it from Yiffit, only my 3 comments appear, while it also says there are 36 total. According to the subscriber count, I am the first person on Yiffit to subscribe there, and that was about an hour ago.

[-] r00ty@kbin.life 4 points 1 year ago

Different comment counts between instances is a federation thing, yes. But showing a number of comments different to the comments shown on the same instance, not.

There are reasons for missing comments, especially on communities from lemmy.world right now. But that's not what is being reported. A federation message for a post does not contain the number of comments (and that would be a totally pointless property to send). It's also quite common that certain comments don't make it over federation.

The screenshot is showing a comment count without comments, that means the instance has one comment locally but for some reason is now showing it. That's not a federation thing.

[-] runaway 2 points 1 year ago

Says the comment posted 107 minutes in the future, apparently

[-] r00ty@kbin.life 5 points 1 year ago

This is a known kbin/lemmy thing. Kbin sends dates with a timezone attached, lemmy expects UTC. I actually keep meaning to set the server to UTC to stop this happening.

[-] exu@feditown.com 2 points 1 year ago

Iirc the Lemmy devs are aware of this and working on it.

[-] r00ty@kbin.life 1 points 1 year ago* (last edited 1 year ago)

Yeah, we can also solve it by setting server to UTC. Hopefully the time on this comment is better.

[-] runaway 1 points 1 year ago

Ahh, good to know. Thanks for the info!

[-] Nighed@sffa.community 3 points 1 year ago

I have seen this happen entirely contained on a single instance (community and my account on the same instance) I don't have bots blocked.

So I suspect something is funky somewhere, will try to see how it displays in other apps(and kbin etc later)

this post was submitted on 11 Aug 2023
221 points (98.3% liked)

Fediverse

28555 readers
452 users here now

A community to talk about the Fediverse and all it's related services using ActivityPub (Mastodon, Lemmy, KBin, etc).

If you wanted to get help with moderating your own community then head over to !moderators@lemmy.world!

Rules

Learn more at these websites: Join The Fediverse Wiki, Fediverse.info, Wikipedia Page, The Federation Info (Stats), FediDB (Stats), Sub Rehab (Reddit Migration), Search Lemmy

founded 2 years ago
MODERATORS