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 ef2a1f327c90429b3d1d9d11f6f0e51e9b4e42e0..4b6abe75ac3a917723451623846c0c4f4f14c217 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)
             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')
         # Make sure it's not already being loaded
         if self.loading is None:
             log.msg('Loading the packages cache')