We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f5199d8 commit 9084e00Copy full SHA for 9084e00
1 file changed
src/main.ts
@@ -18,8 +18,13 @@ let githubToken: string
18
19
const cachedGithubToken = await CACHE.get("github-token")
20
21
-// If exists and at most 4 hours old
22
-if (cachedGithubToken) {
+const EIGHT_HOURS = 8 * 60 * 60 * 1000
+
23
+// If exists and at most 8 hours old
24
+if (
25
+ cachedGithubToken &&
26
+ Date.now() - cachedGithubToken.createdAt < EIGHT_HOURS
27
+) {
28
githubToken = cachedGithubToken.value
29
} else {
30
githubToken = await getGitHubToken()
0 commit comments