• Dev
  • Like Counter extension beta

@Gatsu Alright! I found the issue and have pushed an update to correct everything. Update when you have a second and let me know if you have anymore issues.

Thanks for raising this issue.

    Good stuff! Let me know if you need anything else / have any features you'd like in the next version.

    a month later

    Pushing a few changes to the plugin tonight. If you guys have features you want added, let me know.

      I love everything about this thread and this community. I was just thinking about a feature like this, excited to try the latest.

      hrvoje_hr Currently, no! The current version is designed just for the 'Likes' extension. But I hope to add that in the near future.

      24 days later

      I wonder if it is possible to activate a ranking page within the extension. Did anyone maybe already implemented it? I guess querying the database won't be a problem, but I am not familiar with how to integrate the result properly to flarum as an own page maybe. Suggestions?

        2 months later
        2 months later

        m4v3rick Hey there! Sorry, I've been away from the community for a hot minute. I'm looking at possibly getting back into stuff over the holidays. Was there something you needed?

          2 months later

          johnlewissims
          Hey and sorry for the late reply. I haven't been logged in recently too.
          Yeah,

          I would actually need a few things:

          • Like list (top X) --> m4v3rick
          • Compatibility with beta 15 (although we are still on beta 13, but want to update in February). Is it compatible?
          • Performance: I have really bad CPU performance and after turning the extension off, everything works like a charm.

          The community and mainly @askvortsov helped me a lot with the identification of that issue. That's what he told me (hopefully I am allowed to insert it in here):

          https://github.com/johnlewissims/like-counter/blob/master/src/Serializers/EjinUserSerializer.php#L26-L28
          That's the issue
          Every time it returns ANY posts (note that big discussions have >5k posts), it will go through EVERY like for EVERY post that the author of that post has made.
          Essentially, it's recalculating constantly something that should be calculated and cached once. The better system might be listening in to the Liked event, and whenever a post is liked, updating a "likes received" cache value for the user in the database, then returning that.

            m4v3rick Quick correction on my part: since the API fetches at most 20 posts at a time, it'll make 20 queries, not 500 ones (that's why your 5000 post discussion loaded as slow as your 200 post one). I overlooked that in my explanation yesterday. Other than that, everything is as stated above.