diff --git a/lib/get-site-map.ts b/lib/get-site-map.ts index 984e3dbdb9..59869b3582 100644 --- a/lib/get-site-map.ts +++ b/lib/get-site-map.ts @@ -6,8 +6,10 @@ import * as types from './types' import { includeNotionIdInUrls } from './config' import { getCanonicalPageId } from './get-canonical-page-id' import { notion } from './notion-api' +import ExpiryMap from 'expiry-map' const uuid = !!includeNotionIdInUrls +const cache = new ExpiryMap(10000) export async function getSiteMap(): Promise { const partialSiteMap = await getAllPages( @@ -22,7 +24,8 @@ export async function getSiteMap(): Promise { } const getAllPages = pMemoize(getAllPagesImpl, { - cacheKey: (...args) => JSON.stringify(args) + cacheKey: (...args) => JSON.stringify(args), + cache }) async function getAllPagesImpl(