agent/cache: remove error return from fetch

A previous change removed the only error, so the return value can be
removed now.
This commit is contained in:
Daniel Nephin 2020-04-13 15:57:19 -04:00
parent 4ef9fc9f27
commit 81755c860a
1 changed files with 7 additions and 12 deletions

19
agent/cache/cache.go vendored
View File

@ -388,10 +388,7 @@ RETRY_GET:
// At this point, we know we either don't have a value at all or the
// value we have is too old. We need to wait for new data.
waiterCh, err := c.fetch(key, r, true, 0, false)
if err != nil {
return nil, ResultMeta{Index: entry.Index}, err
}
waiterCh := c.fetch(key, r, true, 0, false)
// No longer our first time through
first = false
@ -420,20 +417,18 @@ func makeEntryKey(t, dc, token, key string) string {
// If allowNew is true then the fetch should create the cache entry
// if it doesn't exist. If this is false, then fetch will do nothing
// if the entry doesn't exist. This latter case is to support refreshing.
func (c *Cache) fetch(key string, r getOptions, allowNew bool, attempt uint, ignoreExisting bool) (<-chan struct{}, error) {
info := r.Info
func (c *Cache) fetch(key string, r getOptions, allowNew bool, attempt uint, ignoreExisting bool) <-chan struct{} {
// We acquire a write lock because we may have to set Fetching to true.
c.entriesLock.Lock()
defer c.entriesLock.Unlock()
ok, entryValid, entry := c.getEntryLocked(r.TypeEntry, key, info)
ok, entryValid, entry := c.getEntryLocked(r.TypeEntry, key, r.Info)
// This handles the case where a fetch succeeded after checking for its existence in
// getWithIndex. This ensures that we don't miss updates.
if ok && entryValid && !ignoreExisting {
ch := make(chan struct{})
close(ch)
return ch, nil
return ch
}
// If we aren't allowing new values and we don't have an existing value,
@ -442,13 +437,13 @@ func (c *Cache) fetch(key string, r getOptions, allowNew bool, attempt uint, ign
if !ok && !allowNew {
ch := make(chan struct{})
close(ch)
return ch, nil
return ch
}
// If we already have an entry and it is actively fetching, then return
// the currently active waiter.
if ok && entry.Fetching {
return entry.Waiter, nil
return entry.Waiter
}
// If we don't have an entry, then create it. The entry must be marked
@ -645,7 +640,7 @@ func (c *Cache) fetch(key string, r getOptions, allowNew bool, attempt uint, ign
}
}()
return entry.Waiter, nil
return entry.Waiter
}
func backOffWait(failures uint) time.Duration {