-
Notifications
You must be signed in to change notification settings - Fork 73
fix cache population hanging #648
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@opennextjs/cloudflare": patch | ||
--- | ||
|
||
fix cache population hanging |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,6 +100,8 @@ async function populateR2IncrementalCache( | |
|
||
const config = unstable_readConfig({ env: populateCacheOptions.environment }); | ||
const proxy = await getPlatformProxy<CloudflareEnv>(populateCacheOptions); | ||
const prefix = proxy.env[R2_CACHE_PREFIX_ENV_NAME]; // Set the cache type to R2 for the current environment | ||
await proxy.dispose(); | ||
|
||
|
||
const binding = config.r2_buckets.find(({ binding }) => binding === R2_CACHE_BINDING_NAME); | ||
if (!binding) { | ||
|
@@ -115,7 +117,7 @@ async function populateR2IncrementalCache( | |
|
||
for (const { fullPath, key, buildId, isFetch } of tqdm(assets)) { | ||
const cacheKey = computeCacheKey(key, { | ||
prefix: proxy.env[R2_CACHE_PREFIX_ENV_NAME], | ||
prefix, | ||
buildId, | ||
cacheType: isFetch ? "fetch" : "cache", | ||
}); | ||
|
@@ -139,6 +141,8 @@ async function populateKVIncrementalCache( | |
|
||
const config = unstable_readConfig({ env: populateCacheOptions.environment }); | ||
const proxy = await getPlatformProxy<CloudflareEnv>(populateCacheOptions); | ||
const prefix = proxy.env[KV_CACHE_PREFIX_ENV_NAME]; | ||
await proxy.dispose(); | ||
|
||
const binding = config.kv_namespaces.find(({ binding }) => binding === KV_CACHE_BINDING_NAME); | ||
if (!binding) { | ||
|
@@ -159,7 +163,7 @@ async function populateKVIncrementalCache( | |
.slice(i * chunkSize, (i + 1) * chunkSize) | ||
.map(({ fullPath, key, buildId, isFetch }) => ({ | ||
key: computeCacheKey(key, { | ||
prefix: proxy.env[KV_CACHE_PREFIX_ENV_NAME], | ||
prefix, | ||
buildId, | ||
cacheType: isFetch ? "fetch" : "cache", | ||
}), | ||
|
Uh oh!
There was an error while loading. Please reload this page.