mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
Remove progressive rollout for markdown stable links (#4230)
This commit is contained in:
@@ -10,7 +10,6 @@ import { getCacheTag, getComputedContentSourceCacheTags } from '@gitbook/cache-t
|
||||
import { parse as parseCacheControl } from '@tusbar/cache-control';
|
||||
import { cacheLife, cacheTag } from 'next/cache';
|
||||
import { cache } from '../cache';
|
||||
import { isRollout } from '../rollout';
|
||||
import { DataFetcherError, wrapCacheDataFetcherError } from './errors';
|
||||
import type { GitBookDataFetcher } from './types';
|
||||
|
||||
@@ -88,19 +87,7 @@ export function createDataFetcher(
|
||||
});
|
||||
},
|
||||
getRevisionPageMarkdown(params) {
|
||||
if (
|
||||
isRollout({
|
||||
discriminator: params.spaceId,
|
||||
percentageRollout: 50,
|
||||
})
|
||||
) {
|
||||
return getRevisionPageMarkdown(input, {
|
||||
spaceId: params.spaceId,
|
||||
revisionId: params.revisionId,
|
||||
pageId: params.pageId,
|
||||
});
|
||||
}
|
||||
return getRevisionPageMarkdownV1(input, {
|
||||
return getRevisionPageMarkdown(input, {
|
||||
spaceId: params.spaceId,
|
||||
revisionId: params.revisionId,
|
||||
pageId: params.pageId,
|
||||
@@ -321,42 +308,6 @@ const getRevision = cache(
|
||||
}
|
||||
);
|
||||
|
||||
const getRevisionPageMarkdownV1 = cache(
|
||||
async (
|
||||
input: DataFetcherInput,
|
||||
params: { spaceId: string; revisionId: string; pageId: string }
|
||||
) => {
|
||||
'use cache: remote';
|
||||
return wrapCacheDataFetcherError(async () => {
|
||||
return trace(
|
||||
`getRevisionPageMarkdown(${params.spaceId}, ${params.revisionId}, ${params.pageId})`,
|
||||
async () => {
|
||||
const api = apiClient(input);
|
||||
const res = await api.spaces.getPageInRevisionById(
|
||||
params.spaceId,
|
||||
params.revisionId,
|
||||
params.pageId,
|
||||
{
|
||||
format: 'markdown',
|
||||
},
|
||||
{
|
||||
...noCacheFetchOptions,
|
||||
}
|
||||
);
|
||||
|
||||
cacheTag(...getCacheTagsFromResponse(res));
|
||||
cacheLife('max');
|
||||
|
||||
if (!('markdown' in res.data)) {
|
||||
throw new DataFetcherError('Page is not a document', 404);
|
||||
}
|
||||
return res.data.markdown;
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
const getRevisionPageMarkdown = cache(
|
||||
async (
|
||||
input: DataFetcherInput,
|
||||
|
||||
Reference in New Issue
Block a user