Skip to content

Commit

Permalink
fix(cowfi): reduce cms requests cache time to 5 min (#5196)
Browse files Browse the repository at this point in the history
  • Loading branch information
shoom3301 authored Dec 12, 2024
1 parent 83e4050 commit 8893f35
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/cow-fi/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
],
},
Expand Down
4 changes: 2 additions & 2 deletions apps/cow-fi/services/cms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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 } }),
}

/**
Expand Down

0 comments on commit 8893f35

Please sign in to comment.