Pass next.internal on fetch requests to avoid I/O sharing (#197)

This commit is contained in:
Samy Pessé
2024-02-28 15:26:36 +01:00
committed by GitHub
parent 70c6c9df42
commit 2df5d68eae
2 changed files with 8 additions and 1 deletions
+5 -1
View File
@@ -9,7 +9,11 @@ export const noCacheFetchOptions: Partial<RequestInit> = {
// Cloudflare doesn't support the `cache` directive before next-on-pages patches the fetch function
// https://github.com/cloudflare/workerd/issues/698
// cache: 'no-store',
next: { revalidate: 0 },
next: {
revalidate: 0,
// @ts-ignore - experiment to bypass potential I/O sharing in Next
internal: true,
},
};
/**
+3
View File
@@ -1,5 +1,7 @@
import 'server-only';
import { noCacheFetchOptions } from '@/lib/cache/http';
import { rootUrl } from './links';
export interface CloudflareImageJsonFormat {
@@ -147,6 +149,7 @@ export async function resizeImage(
: `image/${resizeOptions.format || 'jpeg'}`,
},
signal,
...noCacheFetchOptions,
},
);