-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure handleUnlock is called even for non-cached responses (#70766)
When a response is unsuccessful, we might still have acquired an incremental cache lock and only realized we couldn't cache it after receiving a non-success response code. `handleUnlock` is called in the case of a successful response or a response received during a dynamic render, but not in the case of an unsuccessful response. This adds the missing `handleUnlock` for non-cached responses. This used to be handled appropriately but was lost in some recent refactors. No explicit test case was added here as the reproduction in the failing case was just a hanging build. So if the build passes and does not hang, the test was successful. Validated it was hanging before implementing this fix.
- Loading branch information
Showing
3 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
test/e2e/app-dir/app-fetch-deduping/app/bad-response-page/[slug]/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// This page is validating that despite multiple unsuccessful responses to the same, potentially cached URLs, | ||
// the build locks are resolved and the page is still built successfully. | ||
export async function generateStaticParams() { | ||
return [ | ||
{ | ||
slug: 'slug-0', | ||
}, | ||
{ | ||
slug: 'slug-1', | ||
}, | ||
{ | ||
slug: 'slug-2', | ||
}, | ||
{ | ||
slug: 'slug-3', | ||
}, | ||
{ | ||
slug: 'slug-4', | ||
}, | ||
] | ||
} | ||
|
||
export default async function Page({ params }) { | ||
const data = await fetch( | ||
`http://localhost:${process.env.TEST_SERVER_PORT}?status=404` | ||
).then((res) => res.text()) | ||
await fetch( | ||
`http://localhost:${process.env.TEST_SERVER_PORT}?status=404` | ||
).then((res) => res.text()) | ||
|
||
return ( | ||
<> | ||
<p>hello world</p> | ||
<p id="data">{data}</p> | ||
</> | ||
) | ||
} |