Skip to content

Commit

Permalink
add read lock for latest version map (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
tianxiaoliang committed Jan 8, 2019
1 parent 0e89032 commit f41727a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/registry/cache_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@ func (ic *IndexCache) Get(k string, tags map[string]string) ([]*MicroServiceInst

}
func (ic *IndexCache) setTagsBeforeQuery(k string, tags map[string]string) {
ic.muxLatestV.RLock()
//must set version before query
if v, ok := tags[common.BuildinTagVersion]; ok && v == common.LatestVersion && ic.latestV[k] != "" {
tags[common.BuildinTagVersion] = ic.latestV[k]
}
ic.muxLatestV.RUnlock()
}

//must combine keys in order, use sets to return sorted list
Expand Down

0 comments on commit f41727a

Please sign in to comment.