-
-
Notifications
You must be signed in to change notification settings - Fork 125
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
Some companies listed as related to themselves #1101
Comments
This surprised me since we do already have a condition in place that should prevent this exact problem:
|
Debugging this, I found that That makes sense! We are heavily caching the related companies calculation (an optimization that is very necessary as explained in the commit message of bce6bff): website/layouts/company/single.html Line 119 in 005798d
However, we are only varying the cache based on the categories and relevant countries. Thus, we will get the wrong permalink for cached renders, of course. Unfortunately, we can't just also pass the permalink to |
Solution is a bit annoying but not too bad: We make the related companies partial into a function that returns an array of the candidates and then do the filtering on each individual page. Only question is how much of a performance impact that is, so let's do some benchmarking. Running on my machine (I ran each one multiple times to hopefully negate disk caching fluctuations):
Looking good! |
We've received a report that some companies are listed as related to themselves, e.g. https://www.datarequests.org/company/ndr/:
The text was updated successfully, but these errors were encountered: