DEV Community

loading...

What are the changes in Forem code for displaying postviews on DEV?

amananandrai profile image amananandrai ・1 min read

I was wondering about the changes been made into the Forem codebase to display total postviews on the DEV dashboard page. I saw some changes in the behavior of update of postviews and tried to find out about and saw that a PR was merged to update the pageviews. I was just able to understand that some changes were made into the codebase but not able to understand what actually has happened there.

I would like to know in simpler terms what are the changes been made and how will they affect the performance of the site? Also, what is the new frequency of update of post/pageviews?

Is this change updated in all communities powered by Forem or just for DEV?

Also for a beginner how can we think about making such changes(related to caching) in a project and how to assess that our project needs some changes?

Discussion (2)

pic
Editor guide
Collapse
ben profile image
Ben Halpern

I believe that change was mostly refactoring the logic about how this was done without substantial changes to the frequency or actual behavior (not that this couldn't change in the future).

The change was that instead of updating some of this logic right in the controller periodically, it is instead updated in an asynchronous "worker" because this update is not high priority.

Yes, this logic will be deployed to all Forems, as they are re-uses of the same exact code, configured by admins.

Collapse
amananandrai profile image
amananandrai Author

Thanks for your reply and awesome explanation. I would further like to know what a "worker" is and a bit more about worker for a beginner like me to understand.