Skip to content

Commit 2593e32

Browse files
fix(backend): add TTL for descriptions, improve package json filtering
1 parent 495886b commit 2593e32

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/lib/server/github-cache.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ const per_page = 100;
2525
/**
2626
* The TTL of the cached values, in seconds.
2727
*/
28-
const cacheTTL = 60 * 15;
28+
const cacheTTL = 60 * 15; // 15 min
29+
/**
30+
* The TTL of the cached values, in seconds.
31+
*/
32+
const longCacheTTL = 60 * 60 * 24 * 10; // 10 days
2933

3034
/**
3135
* A fetch layer to reach the GitHub API
@@ -252,7 +256,9 @@ export class GitHubCache {
252256
.filter(path => path !== undefined)
253257
.filter(
254258
path =>
255-
!path.includes("/test/") && (path === "package.json" || path.endsWith("/package.json"))
259+
!path.includes("/test/") &&
260+
!path.includes("/e2e-tests/") &&
261+
(path === "package.json" || path.endsWith("/package.json"))
256262
);
257263

258264
const descriptions = new Map<string, string>();
@@ -278,6 +284,7 @@ export class GitHubCache {
278284
}
279285

280286
await this.#redis.json.set(cacheKey, "$", Object.fromEntries(descriptions));
287+
await this.#redis.expire(cacheKey, longCacheTTL);
281288

282289
return Object.fromEntries(descriptions);
283290
}

0 commit comments

Comments
 (0)