Commit e1542300 authored by gmarek's avatar gmarek

Add fast-path for Listing with ResourceVersion=0

parent 3932d127
...@@ -283,11 +283,14 @@ func (w *watchCache) waitUntilFreshAndBlock(resourceVersion uint64, trace *util. ...@@ -283,11 +283,14 @@ func (w *watchCache) waitUntilFreshAndBlock(resourceVersion uint64, trace *util.
// WaitUntilFreshAndList returns list of pointers to <storeElement> objects. // WaitUntilFreshAndList returns list of pointers to <storeElement> objects.
func (w *watchCache) WaitUntilFreshAndList(resourceVersion uint64, trace *util.Trace) ([]interface{}, uint64, error) { func (w *watchCache) WaitUntilFreshAndList(resourceVersion uint64, trace *util.Trace) ([]interface{}, uint64, error) {
// If resourceVersion == 0 we'll return the data that we currently have in cache.
if resourceVersion != 0 {
err := w.waitUntilFreshAndBlock(resourceVersion, trace) err := w.waitUntilFreshAndBlock(resourceVersion, trace)
defer w.RUnlock() defer w.RUnlock()
if err != nil { if err != nil {
return nil, 0, err return nil, 0, err
} }
}
return w.store.List(), w.resourceVersion, nil return w.store.List(), w.resourceVersion, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment