1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-10-05 19:30:59 +00:00

chore: cache: move findCacheWithIsolationKeyFallback out of handler.find

This commit is contained in:
Earl Warren 2025-09-05 17:21:53 +02:00
parent c48accfb51
commit 5f0b036e34
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 16 additions and 9 deletions

View file

@ -177,19 +177,11 @@ func (h *handler) find(w http.ResponseWriter, r *http.Request, params httprouter
}
defer db.Close()
cache, err := findCache(db, repo, keys, version, rundata.WriteIsolationKey)
cache, err := findCacheWithIsolationKeyFallback(db, repo, keys, version, rundata.WriteIsolationKey)
if err != nil {
h.responseFatalJSON(w, r, err)
return
}
// If read was scoped to WriteIsolationKey and didn't find anything, we can fallback to the non-isolated cache read
if cache == nil && rundata.WriteIsolationKey != "" {
cache, err = findCache(db, repo, keys, version, "")
if err != nil {
h.responseFatalJSON(w, r, err)
return
}
}
if cache == nil {
h.responseJSON(w, r, 204)
return