Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cowfi): reduce cms requests cache time to 5 min #5196

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading