From 8893f35e177f86eef15ad2790034b705cf91e349 Mon Sep 17 00:00:00 2001 From: Alexandr Kazachenko Date: Thu, 12 Dec 2024 20:02:19 +0500 Subject: [PATCH] fix(cowfi): reduce cms requests cache time to 5 min (#5196) --- apps/cow-fi/next.config.js | 2 +- apps/cow-fi/services/cms/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/cow-fi/next.config.js b/apps/cow-fi/next.config.js index 914f6503b2..a22161afeb 100644 --- a/apps/cow-fi/next.config.js +++ b/apps/cow-fi/next.config.js @@ -100,7 +100,7 @@ const nextConfig = { headers: [ { key: 'Cache-Control', - value: 'public, s-maxage=60, stale-while-revalidate=600', + value: 'public, s-maxage=60, stale-while-revalidate=300', }, ], }, diff --git a/apps/cow-fi/services/cms/index.ts b/apps/cow-fi/services/cms/index.ts index ef79552118..a6a2555d91 100644 --- a/apps/cow-fi/services/cms/index.ts +++ b/apps/cow-fi/services/cms/index.ts @@ -4,9 +4,9 @@ import qs from 'qs' import { toQueryParams } from 'util/queryParams' import { getCmsClient } from '@cowprotocol/core' -import { DATA_CACHE_TIME_SECONDS } from '@/const/meta' const PAGE_SIZE = 50 +const CMS_CACHE_TIME = 5 * 60 // 5 min type Schemas = components['schemas'] export type Article = Schemas['ArticleListResponseDataItem'] @@ -33,7 +33,7 @@ export const client = getCmsClient() const clientAddons = { // https://github.com/openapi-ts/openapi-typescript/issues/1569#issuecomment-1982247959 - fetch: (request: unknown) => fetch(request as Request, { next: { revalidate: DATA_CACHE_TIME_SECONDS } }), + fetch: (request: unknown) => fetch(request as Request, { next: { revalidate: CMS_CACHE_TIME } }), } /**