Skip to content

Commit f8a0b75

Browse files
Caching updates
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot)
1 parent 4a7b66e commit f8a0b75

3 files changed

Lines changed: 13 additions & 15 deletions

File tree

cla-backend-go/github/github_repository.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ Please update your commit message(s) by doing |git commit --amend| and then |git
6565
`
6666

6767
const (
68-
unknown = "Unknown"
69-
failureState = "failure"
70-
successState = "success"
71-
svgVersion = "?v=2"
72-
NegativeCacheTTL = 3 * time.Minute // Used for negative caching of missing/not-signed users
73-
ProjectCacheTTL = 3 * time.Hour // Used for per-project caching of signed users
74-
MaxCommentLength = 0xff00 // 65520 characters - leave some buffer under 64KB limit
68+
unknown = "Unknown"
69+
failureState = "failure"
70+
successState = "success"
71+
svgVersion = "?v=2"
72+
NegativeCacheTTL = 2 * time.Minute // Used for negative caching of missing/not-signed users
73+
ProjectCacheTTL = 15 * time.Minute // Used for per-project caching of signed users
74+
coAuthorNegativeCacheTTL = 15 * time.Minute
75+
MaxCommentLength = 0xff00 // 65520 characters - leave some buffer under 64KB limit
7576
)
7677

7778
type gqlError struct {
@@ -1041,8 +1042,8 @@ func GetCoAuthorCommits(
10411042
if found {
10421043
GithubUserCache.Set(cacheKey, user)
10431044
} else {
1044-
// negative cache for 30 minutes (this is for GitHub user not found)
1045-
GithubUserCache.SetWithTTL(cacheKey, user, 30*time.Minute)
1045+
// negative cache for GitHub user not found
1046+
GithubUserCache.SetWithTTL(cacheKey, user, coAuthorNegativeCacheTTL)
10461047
}
10471048

10481049
return summary, found

cla-backend-go/v2/signatures/converters.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ func v2Signature(src *v1Models.Signature) (*models.Signature, error) {
2323
if err != nil {
2424
return nil, err
2525
}
26-
if dst.Signatures == nil {
27-
dst.Signatures = make([]*models.Signature, 0)
28-
}
2926
return &dst, nil
3027
}
3128

cla-backend-legacy/internal/legacy/github/cache.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ import (
1818

1919
const (
2020
// NegativeCacheTTL mirrors Python NEGATIVE_CACHE_TTL (3 minutes).
21-
NegativeCacheTTL = 180 * time.Second
21+
NegativeCacheTTL = 120 * time.Second
2222
// ProjectCacheTTL mirrors Python PROJECT_CACHE_TTL (3 hours).
23-
ProjectCacheTTL = 10800 * time.Second
23+
ProjectCacheTTL = 15 * time.Minute
2424
// DefaultCacheTTL mirrors Python github_user_cache default TTL (12 hours).
25-
DefaultCacheTTL = 43200 * time.Second
25+
DefaultCacheTTL = 1 * time.Hour
2626
)
2727

2828
type cacheEntry struct {

0 commit comments

Comments
 (0)