mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-23 22:36:24 +00:00
Fixes to memcache support (#1628)
* Fix errors discovered in dev * Log an error rather than aborting when memcache doesn't resolve * Initialize map correctly * Review tweaks
This commit is contained in:
committed by
Tom Wilkie
parent
682edd37e4
commit
96520d7a46
@@ -55,7 +55,7 @@ type MemcacheClient struct {
|
||||
|
||||
// NewMemcacheClient creates a new MemcacheClient that gets its server list
|
||||
// from SRV and updates the server list on a regular basis.
|
||||
func NewMemcacheClient(host string, timeout time.Duration, service string, updateInterval time.Duration, expiration int32) (*MemcacheClient, error) {
|
||||
func NewMemcacheClient(host string, timeout time.Duration, service string, updateInterval time.Duration, expiration int32) *MemcacheClient {
|
||||
var servers memcache.ServerList
|
||||
client := memcache.NewFromSelector(&servers)
|
||||
client.Timeout = timeout
|
||||
@@ -70,12 +70,12 @@ func NewMemcacheClient(host string, timeout time.Duration, service string, updat
|
||||
}
|
||||
err := newClient.updateMemcacheServers()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
log.Errorf("Error setting memcache servers to '%v': %v", host, err)
|
||||
}
|
||||
|
||||
newClient.wait.Add(1)
|
||||
go newClient.updateLoop(updateInterval)
|
||||
return newClient, nil
|
||||
return newClient
|
||||
}
|
||||
|
||||
// Stop the memcache client.
|
||||
@@ -169,7 +169,7 @@ func (c *MemcacheClient) FetchReports(keys []string) (map[string]report.Report,
|
||||
}(key)
|
||||
}
|
||||
|
||||
var reports map[string]report.Report
|
||||
reports := map[string]report.Report{}
|
||||
for i := 0; i < len(keys)-len(missing); i++ {
|
||||
r := <-ch
|
||||
if r.report == nil {
|
||||
|
||||
Reference in New Issue
Block a user