FIX: Skip whisper posts when updating topic like count (PR #10157)

GitHub

Do we need a migration for that?

Theoretically, yes, we need one to ensure that all past counts are correct. I did not include one because I imagine it would be very expensive for forums with many topics. I believe I could scope it only to topics which have whisper posts, which would significantly reduce the number of queries.

I would also be fine if it was fixed by a “ensure consistency” job.

In this case I think a migration is the better solution. :blush:

We should ensure we’re not updating a row to the exact same value as well :wink:

AND topics.like_count <> tbl.like_count

I would put the sum(:like_count) on the next line.

This looks good to me, my only concern is that the migration is expensive, imagine if there are 2,000,000 topics in the database.

whispers are a default disabled feature, maybe only do this “correct history” thing if you select from the site_settings table and it was enabled on the site.

1 Like