changeset 428:a4a9efadabfc

core: fixed memory initialisation sequence
author Goffi <goffi@goffi.org>
date Fri, 11 Nov 2011 19:49:00 +0100
parents bb0236633da5
children 37285f2d37c8
files src/tools/memory.py
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/tools/memory.py	Fri Nov 11 18:40:23 2011 +0100
+++ b/src/tools/memory.py	Fri Nov 11 19:49:00 2011 +0100
@@ -494,7 +494,6 @@
     def __init__(self, host):
         info (_("Memory manager init"))
         self.initialized = defer.Deferred() 
-        init_defers = [] #list of deferred to wait before initialization is finished
         self.host = host
         self.contacts={}
         self.presenceStatus={}
@@ -511,9 +510,8 @@
         self.storage = SqliteStorage(database_file)
         self.params=Param(host, self.storage)
         self.loadFiles()
-        self.storage.initialized.addCallback(lambda ignore: self.load(init_defers))
-        
-        defer.DeferredList(init_defers).chainDeferred(self.initialized)
+        d = self.storage.initialized.addCallback(self.load)
+        d.chainDeferred(self.initialized)
 
     def parseMainConf(self):
         """look for main .ini configuration file, and parse it"""
@@ -568,11 +566,10 @@
             except:
                 error (_("Can't load private values !"))
 
-    def load(self, init_defers):
-        """Load parameters and all memory things from db
-        @param init_defers: list of deferred to wait before parameters are loaded"""
+    def load(self, ignore):
+        """Load parameters and all memory things from db"""
         #parameters data
-        init_defers.append(self.params.loadGenParams())
+        return self.params.loadGenParams()
 
     def loadIndividualParams(self, profile):
         """Load individual parameters for a profile