Merge pull request #478 from sneat/fix-watcher-across-datacenters
Use existing consul client for watcher
This commit is contained in:
commit
dc5ec0cdb2
@ -2,6 +2,8 @@ package consul
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"github.com/hashicorp/consul/api"
|
||||
@ -43,7 +45,7 @@ func newConsulWatcher(cr *consulRegistry, opts ...registry.WatchOption) (registr
|
||||
}
|
||||
|
||||
wp.Handler = cw.handle
|
||||
go wp.Run(cr.Address)
|
||||
go wp.RunWithClientAndLogger(cr.Client, log.New(os.Stderr, "", log.LstdFlags))
|
||||
cw.wp = wp
|
||||
|
||||
return cw, nil
|
||||
@ -208,7 +210,7 @@ func (cw *consulWatcher) handle(idx uint64, data interface{}) {
|
||||
})
|
||||
if err == nil {
|
||||
wp.Handler = cw.serviceHandler
|
||||
go wp.Run(cw.r.Address)
|
||||
go wp.RunWithClientAndLogger(cw.r.Client, log.New(os.Stderr, "", log.LstdFlags))
|
||||
cw.watchers[service] = wp
|
||||
cw.next <- ®istry.Result{Action: "create", Service: ®istry.Service{Name: service}}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user