Skip to content

Commit 30d9990

Browse files
authored
fix: set longer ttl for ungh (#2272)
1 parent eced357 commit 30d9990

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/composables/useRepoMeta.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { parseRepoUrl, GITLAB_HOSTS } from '#shared/utils/git-providers'
33

44
// TTL for git repo metadata (10 minutes - repo stats don't change frequently)
55
const REPO_META_TTL = 60 * 10
6+
// Other TTLs for known sources
7+
const UNGH_REPO_META_TTL = 60 * 60 * 3 // 3 hours (ungh caches 6 hours server-side, but we run it half more frequently)
68

79
export type RepoMetaLinks = {
810
repo: string
@@ -134,7 +136,7 @@ const githubAdapter: ProviderAdapter = {
134136
const { data } = await cachedFetch<UnghRepoResponse>(
135137
`https://ungh.cc/repos/${ref.owner}/${ref.repo}`,
136138
{ headers: { 'User-Agent': 'npmx', ...options.headers }, ...options },
137-
REPO_META_TTL,
139+
UNGH_REPO_META_TTL,
138140
)
139141
res = data
140142
} catch {

0 commit comments

Comments
 (0)