diff options
author | Jonathan Davies <jonathan.davies@citrix.com> | 2016-03-14 17:17:05 +0000 |
---|---|---|
committer | Jonathan Davies <jonathan.davies@citrix.com> | 2016-03-14 17:23:12 +0000 |
commit | 5c06998aee96aa02fddf1f6d3122ad1badbafd55 (patch) | |
tree | 49ed220dd07c93e810036484184e2fafdf4c0ff2 | |
parent | 29a6d76f70db78953aaaf7633aba32551c9b0e40 (diff) | |
download | vyos-xe-guest-utilities-5c06998aee96aa02fddf1f6d3122ad1badbafd55.tar.gz vyos-xe-guest-utilities-5c06998aee96aa02fddf1f6d3122ad1badbafd55.zip |
CA-203169: remove write-cache expiry timeout
There is no reason to expire cached writes. This lightens the load on xenstore.
-rw-r--r-- | xenstoreclient/xenstore.go | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/xenstoreclient/xenstore.go b/xenstoreclient/xenstore.go index b6a5a86..fa5002c 100644 --- a/xenstoreclient/xenstore.go +++ b/xenstoreclient/xenstore.go @@ -11,7 +11,6 @@ import ( "strconv" "strings" "sync" - "time" ) type Permission int @@ -352,7 +351,6 @@ func (xs *XenStore) StopWatch() error { type CachedXenStore struct { xs XenStoreClient writeCache map[string]string - lastCommit map[string]time.Time } func NewCachedXenstore(tx uint32) (XenStoreClient, error) { @@ -363,20 +361,16 @@ func NewCachedXenstore(tx uint32) (XenStoreClient, error) { return &CachedXenStore{ xs: xs, writeCache: make(map[string]string, 0), - lastCommit: make(map[string]time.Time, 0), }, nil } func (xs *CachedXenStore) Write(path string, value string) error { if v, ok := xs.writeCache[path]; ok && v == value { - if t, ok := xs.lastCommit[path]; ok && t.After(time.Now().Add(-2*time.Minute)) { - return nil - } + return nil } err := xs.xs.Write(path, value) if err == nil { xs.writeCache[path] = value - xs.lastCommit[path] = time.Now() } return err } @@ -415,7 +409,6 @@ func (xs *CachedXenStore) StopWatch() error { func (xs *CachedXenStore) Clear() { xs.writeCache = make(map[string]string, 0) - xs.lastCommit = make(map[string]time.Time, 0) } func getDevPath() (devPath string, err error) { |