Repository navigation
Conversation
Changes the way the KV directory cache works: `scripts/handle-mainline-release.mjs` is triggered by the update links action. Updates the cache entries for the directories that have symlinks. Doesn't add the cache entry for the new released version anymore. When KV listings are enabled, we try fetching the directory from the KV directory cache like usual. If the directory isn't found however, then we fall back to R2. If R2 has the directory, then we return that result and then cache the R2 result in the KV cache for however long `CACHE_KV_TTL` is (currently an arbitary 6 hours). Fixes #1034 Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
flakey5
force-pushed
the
flakey5/20261024/cache
branch
from
October 25, 2026 06:16
1780c66 to
623c576
Compare
Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
MattIPv4
reviewed
Oct 25, 2026
Comment on lines
+46
to
+70
| /** | ||
| * Temp helper function for deciding if we wanna use the KV directory cache or | ||
| * just R2 | ||
| */ | ||
| function determineDirectoryProvider(path: string, ctx: Context): Provider { | ||
| const r2Provider = getR2Provider(ctx); | ||
|
|
||
| if (ctx.env.USE_KV) { | ||
| if (ctx.env.KV_DIRECTORIES === undefined) { | ||
| // Using kv for all directories | ||
| return getKvProvider(ctx, r2Provider); | ||
| } | ||
|
|
||
| for (const prefix of ctx.env.KV_DIRECTORIES) { | ||
| if (path.startsWith(prefix)) { | ||
| // A path we wanna use kv for | ||
| return getKvProvider(ctx, r2Provider); | ||
| } | ||
| } | ||
|
|
||
| // If we're here then it's not a directory we wanna use kv for | ||
| } | ||
|
|
||
| return r2Provider; | ||
| } |
Member
There was a problem hiding this comment.
What do we need to do to make this not temp? Aren't we setting USE_KV already in production?
Member
Author
There was a problem hiding this comment.
Aren't we setting USE_KV already in production?
Yes but we're still not using it for listing nodejs/release/ + want a way to quickly disable it in case something breaks. Once KV is unconditionally enabled we can just remove this function and call the getKvProvider in listDirectory
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.
Changes the way the KV directory cache works:
scripts/handle-mainline-release.mjsis triggered by the update links action. Updates the cache entries for the directories that have symlinks. Doesn't add the cache entry for the new released version anymore.When KV listings are enabled, we try fetching the directory from the KV directory cache like usual. If the directory isn't found however, then we fall back to R2. If R2 has the directory, then we return that result and then cache the R2 result in the KV cache for however long
CACHE_KV_TTLis (currently an arbitary 6 hours).This is 1/2 mrs for this, with the second being a follow up to move us back to using R2's bindings api for uncached directory listings instead of the S3 api.
Fixes #1034