Unverified Commit 9136e053 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

remove retry, it's not used in dev anymore

parent acc80693
...@@ -17,12 +17,8 @@ import { isAppPageRoute } from '../lib/is-app-page-route' ...@@ -17,12 +17,8 @@ import { isAppPageRoute } from '../lib/is-app-page-route'
import { UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY } from '../shared/lib/entry-constants' import { UNDERSCORE_GLOBAL_ERROR_ROUTE_ENTRY } from '../shared/lib/entry-constants'
import getAssetPathFromRoute from '../shared/lib/router/utils/get-asset-path-from-route' import getAssetPathFromRoute from '../shared/lib/router/utils/get-asset-path-from-route'
import { Bundler } from '../lib/bundler' import { Bundler } from '../lib/bundler'
import { wait } from '../lib/wait'
import { getBuildDistDir } from '../export/utils' import { getBuildDistDir } from '../export/utils'
const DEV_STATIC_INFO_RETRY_TIMEOUT = 5_000
const DEV_STATIC_INFO_RETRY_INTERVAL = 100
export async function getStaticInfoIncludingLayouts({ export async function getStaticInfoIncludingLayouts({
dir, dir,
isInsideAppDir, isInsideAppDir,
...@@ -123,33 +119,23 @@ export async function getStaticInfoIncludingLayouts({ ...@@ -123,33 +119,23 @@ export async function getStaticInfoIncludingLayouts({
} }
baseline = sort(baseline) baseline = sort(baseline)
const retryUntil = Date.now() + DEV_STATIC_INFO_RETRY_TIMEOUT let turbopack: PageStaticInfo
while (true) {
let validationError: Error
try { try {
const turbopack = readStaticInfo() turbopack = readStaticInfo()
} catch (cause) {
if (JSON.stringify(baseline) === JSON.stringify(sort(turbopack))) { throw new Error('Failed to read Turbopack static info from disk', {
return turbopack cause,
})
} }
validationError = new Error( if (JSON.stringify(baseline) !== JSON.stringify(sort(turbopack))) {
throw new Error(
`Static info mismatch for ${pageFilePath}: ` + `Static info mismatch for ${pageFilePath}: ` +
JSON.stringify({ baseline, turbopack }, null, 2) JSON.stringify({ baseline, turbopack }, null, 2)
) )
} catch (cause) {
validationError = new Error(
'Failed to read Turbopack static info from disk',
{ cause }
)
} }
if (!isDev || Date.now() >= retryUntil) { return turbopack
throw validationError
}
await wait(DEV_STATIC_INFO_RETRY_INTERVAL)
}
} else { } else {
return readStaticInfo() return readStaticInfo()
} }
......
...@@ -647,7 +647,8 @@ async function startWatcher( ...@@ -647,7 +647,8 @@ async function startWatcher(
// static info may be missing or stale here. // static info may be missing or stale here.
// //
// TODO switch this over to Turbopack emitted static-info.json once we have solved the // TODO switch this over to Turbopack emitted static-info.json once we have solved the
// double-watcher race condition situation. // double-watcher race condition situation. This is an unfortunate dev vs builds
// discrepancy
const getStaticInfoIncludingLayoutsFromSource = ( const getStaticInfoIncludingLayoutsFromSource = (
require('../../../build/get-static-info-including-layouts') as typeof import('../../../build/get-static-info-including-layouts') require('../../../build/get-static-info-including-layouts') as typeof import('../../../build/get-static-info-including-layouts')
).getStaticInfoIncludingLayoutsFromSource ).getStaticInfoIncludingLayoutsFromSource
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment