Cache for deduplicating top-level in-progress requests#2107
Draft
katrinafyi wants to merge 24 commits intolycheeverse:masterfrom
Draft
Cache for deduplicating top-level in-progress requests#2107katrinafyi wants to merge 24 commits intolycheeverse:masterfrom
katrinafyi wants to merge 24 commits intolycheeverse:masterfrom
Conversation
This reverts commit 6522758.
This reverts commit 9f86155.
This reverts commit 2fdac22.
After source tracking, adding a Request to a HashSet is ineffective because it contains a unique location for each request. As an added side-effect, removing the deduplication means URLs will be sent to the stream in file order, which is nice.
This reverts commit 53748f3.
- some idea of cache key hierarchy. maybe stored within the cache? - the computation is allowed to fail with network error. or maybe we just store the error in the cache too. - or maybe this cache should *only* store requests with fragments. that sounds okay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This improves the top-level cache by teaching it to understand "in-progress" requests and abstracts it into a generic Cache struct. See the docs for the new types: https://in-flight-url-cache.lychee-docs-katrinafyi.pages.dev/lychee_lib/cache/
This means that when duplicate URLs are collected from sources (e.g., due to different positions in the file), there will be only one actual request to that URL. Additionally, this means that repeated requests can be sent to a side-queue to wait for the initial request to finish, freeing up the main worker tasks for real link checks. (This is an improvement compared to the Host cache, which I commented on here: #2067 (review))
This is old work which I had started but never finished. I'm just posting it now to remind me to work on it and to gather opinions :) Comments are appreciated.
todo:
OK (Cached)messages without--cache.maybe later:
related work: