Don't create a thread to load the packages cache if it's already loaded.
authorCameron Dale <camrdale@gmail.com>
Thu, 17 Apr 2008 18:56:15 +0000 (11:56 -0700)
committerCameron Dale <camrdale@gmail.com>
Thu, 17 Apr 2008 18:56:15 +0000 (11:56 -0700)
apt_p2p/AptPackages.py

index ef2a1f3..4b6abe7 100644 (file)
@@ -243,7 +243,11 @@ class AptPackages:
             self.unload_later.reset(config.gettime('DEFAULT', 'UNLOAD_PACKAGES_CACHE'))
         else:
             self.unload_later = reactor.callLater(config.gettime('DEFAULT', 'UNLOAD_PACKAGES_CACHE'), self.unload)
-            
+        
+        # Check if it's already loaded
+        if self.loaded:
+            return defer.succeed(True)
+        
         # Make sure it's not already being loaded
         if self.loading is None:
             log.msg('Loading the packages cache')