-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Cache external URL results #249
Conversation
As with the tests I am getting back this unfortunately. I think the issue (not a Ruby person) is because a @cache_log_timestamp ||= Date.strptime(@cache_log['time'])
|
Had a chance to spend some time on this today and it's working out the way I want it to. I'm writing this down so that I remember to update the docs/tests this week:
|
This is dumb.
We need to do this, because Travis CI only supports folder caching. It yells with a `EISDIR` if you try to cache a file.
Hmm. Everything appears to be working locally, but while testing on Travis, nothing seems to be caching. It does keep saying that html-proofer's log is being cached, but never that it's being used. |
I think you need to add the directory to |
This is now working as expected on Travis! Part of it was my problem, and part of it was theirs. 😁 I'm heading out on vacation so I'll keep this around for a few days more for comments and will likely merge it in next week. |
Thanks for this @gjtorikian ❤️ This is looking good! There is one thing that I have encountered which does seem a little odd so far. When I test (with 10h cache) and it passes, then I test again with no changes 100's of links still need to be tested. The cache is working for some links but doesn't look like for them all. Do you have any ideas? Thanks!
|
@msh100 Check the cache. Are there any non-2xx errors? If so, those are rechecked. I just now realized that 3xx (like a redirect) is rechecked too, which may not be desirable, and might be happening to you. But I definitely want failures to be rechecked so that the cache can update. |
I checked that, I think they're all 2xx. I have just invited you for access to our website repository, if you check |
Thanks! I'll dig into it 🔜. |
So I've spent some time on the problem yesterday and today and have almost nailed the problem down. There's one weird edge case but I want to clean up the code a bit before pushing this branch up. Thanks for the real-world scenario, it's exposed some inconsistencies between Typheous and the caching! |
Mostly, this deals with inconsistencies regarding the way Typheous handles/changes URLs. The URLs available in the actual HTML text is not the same as the URL that Typheous considers the “actual” URL. Typheous also does not give access to its “actual” URL, and because of this, we must do some workarounds to get as close as possible to the Typheous URL.
Ehh scratch that, I've pushed up my changes. If you'd like you can wipe out our cache file, fetch the new branch, and rerun proofer. You should see (on subsequent runs) the cache mostly working. As I said though there's still one more edge case to iron out. |
After much grinding of teeth I couldn't figure a solution for the edge case. Basically, there's a single URL called In any case, @msh100 I invite you to try using this branch once more and if you find it acceptable I'll do a merge + release. Thanks! |
Regex example for clarity
Thanks @gjtorikian, looks good. I think this cache seems to work reliably, thanks for all your effort! Though this does raise questions about how tests pass with URLs which are IPs that time out (this is likely another issue?)/ |
I'm not sure what you mean here. Are |
Yes, and I guess it was always passing as I have never seen them fail. Look out our repo again, you will see some like http://1.2.3.4/ (I am fairly confident this is unrelated to the caching changes). |
I suspect this might be related to your local network? When I run the tests locally, I get:
To validate that, in 7050961, I added the same IP addresses. These are failing (correctly) for Travis CI. |
Interesting, maybe something to do with how I am running the tests. It passes locally and on travis for me. Thanks for your work on this PR, it's much appreciated ❤️ |
Update: Ignore the issue I was having, I was only checking for 404 - there's no bug. |
Closes #237.
This implements a cache file,
.htmlproofer.log
, which stores the results of all the external URL lookups. Proofer will consult this file if asked to, given a certain range.Everything appears to be working, but I need to write more tests before being certain.