mirror of
https://github.com/modrinth/code.git
synced 2026-08-28 02:24:56 +00:00
fix: make search revalidate & change cache to be 10 minutes (#6682)
* fix: make search revalidate & change cache to be 10 minutes * prepr
This commit is contained in:
@@ -884,7 +884,7 @@ async function search(requestParams: string) {
|
|||||||
const rawResults = await queryClient.fetchQuery({
|
const rawResults = await queryClient.fetchQuery({
|
||||||
queryKey: ['search', 'v3', requestParams],
|
queryKey: ['search', 'v3', requestParams],
|
||||||
queryFn: () =>
|
queryFn: () =>
|
||||||
get_search_results_v3(requestParams) as Promise<{
|
get_search_results_v3(requestParams, 'must_revalidate') as Promise<{
|
||||||
result: Labrinth.Search.v3.SearchResults & {
|
result: Labrinth.Search.v3.SearchResults & {
|
||||||
hits: (Labrinth.Search.v3.ResultSearchProject & { installed?: boolean })[]
|
hits: (Labrinth.Search.v3.ResultSearchProject & { installed?: boolean })[]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,9 @@ impl CacheValueType {
|
|||||||
// ModpackFiles never expire - version_id is immutable so hashes never change
|
// ModpackFiles never expire - version_id is immutable so hashes never change
|
||||||
// TODO: There has to be a way to exclude this from the "Purge cache" stuff?
|
// TODO: There has to be a way to exclude this from the "Purge cache" stuff?
|
||||||
CacheValueType::ModpackFiles => 100 * 365 * 24 * 60 * 60, // 100 years (effectively never)
|
CacheValueType::ModpackFiles => 100 * 365 * 24 * 60 * 60, // 100 years (effectively never)
|
||||||
|
CacheValueType::SearchResults | CacheValueType::SearchResultsV3 => {
|
||||||
|
10 * 60 // 10 minutes
|
||||||
|
}
|
||||||
_ => 30 * 60, // 30 minutes
|
_ => 30 * 60, // 30 minutes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user