mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
bust revision page markdown (#4235)
This commit is contained in:
@@ -92,8 +92,7 @@
|
||||
},
|
||||
"staging": {
|
||||
"vars": {
|
||||
"OPEN_NEXT_REQUEST_ID_HEADER": "true",
|
||||
"NEXT_PRIVATE_DEBUG_CACHE": "true"
|
||||
"OPEN_NEXT_REQUEST_ID_HEADER": "true"
|
||||
},
|
||||
"r2_buckets": [
|
||||
{
|
||||
@@ -137,8 +136,7 @@
|
||||
// This is a bit misleading, but it means that we can have 500 concurrent revalidations
|
||||
// This means that we'll have up to 100 durable objects instance running at the same time
|
||||
"MAX_REVALIDATE_CONCURRENCY": "100",
|
||||
"OPEN_NEXT_REQUEST_ID_HEADER": "true",
|
||||
"NEXT_PRIVATE_DEBUG_CACHE": "true"
|
||||
"OPEN_NEXT_REQUEST_ID_HEADER": "true"
|
||||
},
|
||||
"r2_buckets": [
|
||||
{
|
||||
|
||||
@@ -29,7 +29,6 @@ export class GitbookIncrementalCache implements IncrementalCache {
|
||||
cacheType?: CacheType
|
||||
): Promise<WithLastModified<CacheValue<CacheType>> | null> {
|
||||
const cacheKey = this.getR2Key(key, cacheType);
|
||||
console.log(`[GitbookIncrementalCache] Getting cache for key: ${cacheKey}`, key, cacheType);
|
||||
|
||||
const r2 = getCloudflareContext().env[BINDING_NAME];
|
||||
if (!r2) throw new Error('No R2 bucket');
|
||||
|
||||
@@ -87,11 +87,18 @@ export function createDataFetcher(
|
||||
});
|
||||
},
|
||||
getRevisionPageMarkdown(params) {
|
||||
return getRevisionPageMarkdown(input, {
|
||||
spaceId: params.spaceId,
|
||||
revisionId: params.revisionId,
|
||||
pageId: params.pageId,
|
||||
});
|
||||
return getRevisionPageMarkdown(
|
||||
input,
|
||||
{
|
||||
spaceId: params.spaceId,
|
||||
revisionId: params.revisionId,
|
||||
pageId: params.pageId,
|
||||
},
|
||||
// We pass the name of the function to distinguish between cache entries
|
||||
// By default Next only uses the arguments, the filename and the position of the function inside the file
|
||||
// By adding a dummy argument with the function name, we can change the order without breaking anything
|
||||
'getRevisionPageMarkdown'
|
||||
);
|
||||
},
|
||||
getRevisionPageDocument(params) {
|
||||
return getRevisionPageDocument(
|
||||
@@ -318,7 +325,9 @@ const getRevision = cache(
|
||||
const getRevisionPageMarkdown = cache(
|
||||
async (
|
||||
input: DataFetcherInput,
|
||||
params: { spaceId: string; revisionId: string; pageId: string }
|
||||
params: { spaceId: string; revisionId: string; pageId: string },
|
||||
// used only to bust the cache
|
||||
_functionName: string
|
||||
) => {
|
||||
'use cache: remote';
|
||||
return wrapCacheDataFetcherError(async () => {
|
||||
|
||||
Reference in New Issue
Block a user