- _write_cached() should be probably avoided when cacheonly.

- when we can't cache the result, we should not run the slow
  len(returnPackages) path at all.

- the cached num, even if stale, is better than assuming num==0.
---
 plugins/auto-update-debuginfo/auto-update-debuginfo.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/auto-update-debuginfo/auto-update-debuginfo.py 
b/plugins/auto-update-debuginfo/auto-update-debuginfo.py
index 539dc91..c0fa85a 100644
--- a/plugins/auto-update-debuginfo/auto-update-debuginfo.py
+++ b/plugins/auto-update-debuginfo/auto-update-debuginfo.py
@@ -103,12 +103,12 @@ def prereposetup_hook(conduit):
     if caching:
         cfname = yb.conf.persistdir + '/plugins/auto-update-debuginfo/num'
         crpmdbv, num = _read_cached(cfname)
-        if num is not None:
+        if num is not None and not yb.conf.cache:
             rpmdbv = yb.rpmdb.simpleVersion(main_only=True)[0]
             if rpmdbv != crpmdbv:
                 num = None
 
-    if num is None:
+    if num is None and not yb.conf.cache:
         num = len(yb.rpmdb.returnPackages(patterns=['*-debuginfo']))
         if caching:
             rpmdbv = yb.rpmdb.simpleVersion(main_only=True)[0]
-- 
1.7.11.7

_______________________________________________
Yum-devel mailing list
Yum-devel@lists.baseurl.org
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to