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:
parent
c48accfb51
commit
5f0b036e34
2 changed files with 16 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue