Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Article ID in Bottom Content Cache Key #1773

Merged
merged 2 commits into from Feb 21, 2019

Conversation

mstruve
Copy link
Contributor

@mstruve mstruve commented Feb 10, 2019

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Documentation Update

Description

If the additional bottom content on the Article show page is being stored under a cache key that is created only using an article's tags, then one could end up seeing a suggested article on the actual article page itself if the tags were the same as a previous article that was viewed. This does mean the cache will be reused less since it is article specific which will affect performance. I am not sure how often this cache is hit across different articles, but that is something to consider.

I also added the article ID to the list of :not_ids for grabbing the @classic_article

I did read the contributing guidelines about adding specs around bug fixes, but since none of the cacheing I saw was tested in the specs and because I could not come up with a good clean test I choose to forgo it. If you determine tests are needed let me know and I can close the PR and reopen after they are added.

Related Tickets & Documents

#1697

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

N/A

Added to documentation?

  • docs.dev.to
  • readme
  • no documentation needed

What gif best describes this PR or how it makes you feel?

Something something, first one is always the worst no matter how many times you have contributed to other repos....

@pr-triage pr-triage bot added the PR: unreviewed bot applied label for PR's with no review label Feb 10, 2019
@CLAassistant
Copy link

CLAassistant commented Feb 10, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@Zhao-Andy Zhao-Andy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, looks great! I think we'll want to figure out the best way to test cache keys first, so not having a test included is alright. Thanks for the PR!

Resolves #1697

@pr-triage pr-triage bot added PR: reviewed-approved bot applied label for PR's where reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Feb 13, 2019
@maestromac
Copy link
Member

Thank you for this PR @mstruve !
Since this would change the cache to be article specific, it would increase our cache by a lot. I don't have enough understanding on the implication this might have our the app. @benhalpern what do you think?

@benhalpern
Copy link
Contributor

Hey @mstruve, sorry I didn’t weigh in sooner.

Basically this PR is spot on. The existing implementation is a bug. Currently it leads to slightly better performance since articles share tags but not IDs, but the behavior inside the cache doesn’t match up well with the stuff outside.

So let’s actually remove the tag sample part of the key and just go with the ID. That will lead to the most cache hits.

Also I think the article’s ID is already implicitely included as a not ID, but I could be wrong there. I’m not in a good place to check right now (on my phone 🙃)

Yeah, @maestromac this will lead to some more cache missed temporarily but it will right itself soon enough. Overall it will yield fewer cache hits but it’s a necessary trade off for actual correct behavior.

This can be merged with the changes I’ve mentioned.

@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: reviewed-approved bot applied label for PR's where reviewer approves changes labels Feb 19, 2019
@pr-triage pr-triage bot added PR: reviewed-approved bot applied label for PR's where reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Feb 20, 2019
@maestromac maestromac merged commit 981f4ed into forem:master Feb 21, 2019
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: reviewed-approved bot applied label for PR's where reviewer approves changes labels Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants