Adopt refresh_delay
s as cache sources TTL
#2334
Closed
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.
refresh_delay
was limited to[1, 168]
, whilesource.prefetchDelay
is 24 which controlled downloading.That makes
refresh_delay
less effective.[1, 24)
triggers reparsing cache sources but no downloading,(24, 168]
is defeated bysource.prefetchDelay
but says still fresh. In other words, value which is non-integer times of 24 is ceiled, and downloading always happen every 24h if there is no failure triggers retry.The process flow was complicated and puzzling. Plus there could be multiple
refresh_delay
s.Now, both downloading and reparsing are ruled by
refresh_delay
,prefetchDelay
is obsoleted. It gives user sense of mastery, with tutelage.More explains:
The delay algorithm of source downloading and reparsing is very complicated and puzzling.
Here are my understandings:
Workflow
Delay
Different
refresh_delay
s of sources make things more complicated. Here are some key rules:prefetchDelay
always controls the downloading, if no failure. At startup,refresh_delay
doesn’t determine delay at all. If the cache expired, then the delay depends on the downloading result. If the cache isn’t expired,delay = source.prefetchDelay - elapsed
.refresh_delay
is only effective at startup or on out-of-step sources, when it< prefetchDelay
and the cache is expired at startup. When it> prefetchDelay
,source.prefetchDelay - elapsed
is smaller. So, if the cache elapsed between them, program will say the cache is fresh but still is going to download the files, and then sleep depending on the result.refresh_delay
doesn’t produce the delay too, when the flow starts fromPrefetchSources
.refresh_delay > prefetchDelay
, but is notN * prefetchDelay
, therefresh_delay % prefetchDelay
will be ceiled to prefetchDelay. Andrefresh_delay < prefetchDelay
too. It makesrefresh_delay
slightly meaningless. And, at startup, the worst case delay is approximately2 * prefetchDelay
.In summary,
refresh_delay
is less effective and makes things puzzling. Adoptingrefresh_delay
as the real delay will make things simple and give user sense of mastery.