Closed hanna-meda closed 4 months ago
fetch_links()
, we can use the function get_rocket_cache_reject_uri()
to get an array of excluded URLs from the cache (which includes the rest API and feed URLs). We probably don't want to do the optimization for excluded pages anyway, so it makes sense to remove them toopreg_match( $reject_uri, $url )
to check if one of the pattern match with one of the URLs foundEffort [S]
Looks good to me
@jeawhanlee I still get the same issue when testing this branch on new.rocketlabs. Did you check that this PR is doing what is expected?
(There is also the wp-json link there).
I think the test case you added in the fixture is wrong because the wp-json and feed links you added have the new.rocketlabs host. So they are discarded in the fetch_links method as they are external links maybe? You should try to put the right hostname in the fixture maybe? If this is correct, as a way to improve and avoid this type of mistake from now on, the TDD approach would have helped: adding the new fixture first, you would have seen that the test was still passing. This would allow you to identif the fixture is not doing what you expect from it?
@MathieuLamiot Thanks for pointing this out, indeed the fixture contained the wrong host, As a matter of fact, the TDD approach was used here and the test failed initially, but along the line, I recopied the wrong fixture from an online html minifier.
Before submitting an issue please check that you’ve completed the following steps:
Describe the bug Currently, having internal RSS feed or restAPI links between the first 10 links on the Homepage, they will be fetched.
To Reproduce Steps to reproduce the behavior:
Expected behavior RSS feed and restAPI links should be excluded from fetching.
Screenshots
Additional context Add any other context about the problem here.
Acceptance Criteria (for WP Media team use only) Clear instructions for developers, to be added before the grooming