Skip to content
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

skip flushToDisk in minimal mode for fetch cache #58516

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions packages/next/src/export/helpers/create-incremental-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@ import { IncrementalCache } from '../../server/lib/incremental-cache'
import { hasNextSupport } from '../../telemetry/ci-info'
import { nodeFs } from '../../server/lib/node-fs-methods'

export function createIncrementalCache(
incrementalCacheHandlerPath: string | undefined,
isrMemoryCacheSize: number | undefined,
fetchCacheKeyPrefix: string | undefined,
distDir: string,
dir: string,
enabledDirectories: NextEnabledDirectories,
export function createIncrementalCache({
incrementalCacheHandlerPath,
isrMemoryCacheSize,
fetchCacheKeyPrefix,
distDir,
dir,
enabledDirectories,
experimental,
flushToDisk,
}: {
incrementalCacheHandlerPath?: string
isrMemoryCacheSize?: number
fetchCacheKeyPrefix?: string
distDir: string
dir: string
enabledDirectories: NextEnabledDirectories
experimental: { ppr: boolean }
) {
flushToDisk?: boolean
}) {
// Custom cache handler overrides.
let CacheHandler: any
if (incrementalCacheHandlerPath) {
Expand All @@ -26,7 +36,7 @@ export function createIncrementalCache(
const incrementalCache = new IncrementalCache({
dev: false,
requestHeaders: {},
flushToDisk: true,
flushToDisk,
fetchCache: true,
maxMemoryCacheSize: isrMemoryCacheSize,
fetchCacheKeyPrefix,
Expand Down
9 changes: 6 additions & 3 deletions packages/next/src/export/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,19 @@ async function exportPageImpl(
// cache instance for this page.
const incrementalCache =
isAppDir && fetchCache
? createIncrementalCache(
? createIncrementalCache({
incrementalCacheHandlerPath,
isrMemoryCacheSize,
fetchCacheKeyPrefix,
distDir,
dir,
enabledDirectories,
// PPR is not available for Pages.
{ ppr: false }
)
experimental: { ppr: false },
// skip writing to disk in minimal mode for now, pending some
// changes to better support it
flushToDisk: !hasNextSupport,
})
: undefined

// Handle App Routes.
Expand Down
Loading