diff --git a/src/handler/image.ts b/src/handler/image.ts index 47260104..23c4c852 100644 --- a/src/handler/image.ts +++ b/src/handler/image.ts @@ -62,7 +62,7 @@ import { createLRU, parseViewBox } from '../utils.js' type ResolvedImageData = [string, number?, number?] | readonly [] export const cache = createLRU(100) -const inflightRequests = new Map>() +export const inflightRequests = new Map>() const ALLOWED_IMAGE_TYPES = [PNG, APNG, JPEG, GIF, SVG] diff --git a/src/satori.ts b/src/satori.ts index 61f2292a..68a113dd 100644 --- a/src/satori.ts +++ b/src/satori.ts @@ -10,7 +10,7 @@ import { segment } from './utils.js' import { detectLanguageCode, LangCode, Locale } from './language.js' import getTw from './handler/tailwind.js' import { preProcessNode } from './handler/preprocess.js' -import { cache } from './handler/image.js' +import { cache, inflightRequests } from './handler/image.js' // We don't need to initialize the opentype instances every time. const fontCache = new WeakMap() @@ -90,6 +90,7 @@ export default async function satori( const processedWordsMissingFonts = new Set() cache.clear() + inflightRequests.clear() await preProcessNode(element) const handler = layout(element, {