Skip to content

Commit af8daca

Browse files
authored
fix: make search revalidate & change cache to be 10 minutes (#6682)
* fix: make search revalidate & change cache to be 10 minutes * prepr
1 parent 2434f0c commit af8daca

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

apps/app-frontend/src/pages/Browse.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ async function search(requestParams: string) {
884884
const rawResults = await queryClient.fetchQuery({
885885
queryKey: ['search', 'v3', requestParams],
886886
queryFn: () =>
887-
get_search_results_v3(requestParams) as Promise<{
887+
get_search_results_v3(requestParams, 'must_revalidate') as Promise<{
888888
result: Labrinth.Search.v3.SearchResults & {
889889
hits: (Labrinth.Search.v3.ResultSearchProject & { installed?: boolean })[]
890890
}

packages/app-lib/src/state/cache.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ impl CacheValueType {
101101
// ModpackFiles never expire - version_id is immutable so hashes never change
102102
// TODO: There has to be a way to exclude this from the "Purge cache" stuff?
103103
CacheValueType::ModpackFiles => 100 * 365 * 24 * 60 * 60, // 100 years (effectively never)
104+
CacheValueType::SearchResults | CacheValueType::SearchResultsV3 => {
105+
10 * 60 // 10 minutes
106+
}
104107
_ => 30 * 60, // 30 minutes
105108
}
106109
}

0 commit comments

Comments
 (0)