mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-18 08:26:38 +02:00
fix(cache): only watch calling service in registry (#2273)
This commit is contained in:
parent
00d819a199
commit
efd4ef0e62
6
registry/cache/cache.go
vendored
6
registry/cache/cache.go
vendored
@ -180,7 +180,7 @@ func (c *cache) get(service string) ([]*registry.Service, error) {
|
||||
|
||||
// only kick it off if not running
|
||||
if !c.running {
|
||||
go c.run()
|
||||
go c.run(service)
|
||||
}
|
||||
|
||||
c.Unlock()
|
||||
@ -316,7 +316,7 @@ func (c *cache) update(res *registry.Result) {
|
||||
|
||||
// run starts the cache watcher loop
|
||||
// it creates a new watcher if there's a problem
|
||||
func (c *cache) run() {
|
||||
func (c *cache) run(service string) {
|
||||
c.Lock()
|
||||
c.running = true
|
||||
c.Unlock()
|
||||
@ -342,7 +342,7 @@ func (c *cache) run() {
|
||||
time.Sleep(time.Duration(j) * time.Millisecond)
|
||||
|
||||
// create new watcher
|
||||
w, err := c.Registry.Watch()
|
||||
w, err := c.Registry.Watch(registry.WatchService(service))
|
||||
if err != nil {
|
||||
if c.quit() {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user