commit:     d9112d003d5d9bcc71d681206522cc161f59f169
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  2 01:11:01 2017 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Thu Feb  2 01:11:03 2017 +0000
URL:        https://gitweb.gentoo.org/proj/layman.git/commit/?id=d9112d00

api.py: Moves instantiation of rdb to above for-loop

There is no need to repeatedly connect to the rdb when syncing
overlays. We are better off connecting once and querying it whenever
we need to. Doing it every time leads us to issues like bug #603296

X-Gentoo-Bug: 603296
X-Gentoo-Bug-URL: https://bugs.gentoo.org/603296

 layman/api.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/layman/api.py b/layman/api.py
index 2c46bb7..73fb72a 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -384,6 +384,7 @@ class LaymanAPI(object):
         success  = []
         repos = self._check_repo_type(repos, "sync")
         db = self._get_installed_db()
+        rdb = self._get_remote_db()
 
         self.output.debug("API.sync(); starting ovl loop", 5)
         for ovl in repos:
@@ -406,7 +407,7 @@ class LaymanAPI(object):
 
             try:
                 self.output.debug("API.sync(); try: 
self._get_remote_db().select(ovl)", 5)
-                ordb = self._get_remote_db().select(ovl)
+                ordb = rdb.select(ovl)
             except UnknownOverlayException:
                 message = 'Overlay "%(repo)s" could not be found in the remote 
'\
                         'lists.\nPlease check if it has been renamed and '\

Reply via email to