Skip to content

Commit

Permalink
Fix cache key for project:branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Carbajal authored and rodrigo-brito committed Oct 5, 2019
1 parent 434b6cb commit f4e185f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions handle/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ func (h *AnalyzerHandle) Handler(w http.ResponseWriter, r *http.Request) {
if branch = r.URL.Query().Get("b"); branch == "" {
branch = "master"
}

result, err := h.Cache.GetSet(projectURL, func() ([]byte, error) {
ok, data, err := h.Storage.Get(projectURL)
key := fmt.Sprintf("%s:%s", projectURL, branch)
result, err := h.Cache.GetSet(key, func() ([]byte, error) {
ok, data, err := h.Storage.Get(key)
if err != nil {
return nil, err
}
Expand All @@ -63,7 +63,7 @@ func (h *AnalyzerHandle) Handler(w http.ResponseWriter, r *http.Request) {
}

go func() {
if err := h.Storage.Save(projectURL, body); err != nil {
if err := h.Storage.Save(key, body); err != nil {
log.Print(err)
}
}()
Expand Down

0 comments on commit f4e185f

Please sign in to comment.