Merge commit 'origin/master' into mdv-gpl3-py26
[odoo/odoo.git] / bin / addons / base / ir / ir_cron.py
index d286781..8076ce4 100644 (file)
@@ -75,13 +75,18 @@ class ir_cron(osv.osv, netsvc.Agent):
             f(cr, uid, *args)
 
     def _poolJobs(self, db_name, check=False):
-        now = DateTime.now()
-        #FIXME: multidb. Solution: a l'instanciation d'une nouvelle connection bd (ds pooler) fo que j'instancie
-        # un nouveau pooljob avec comme parametre la bd
         try:
-            cr = pooler.get_db(db_name).cursor()
+            db, pool = pooler.get_db_and_pool(db_name)
+            if pool._init:
+                # retry in a few minutes
+                self.setAlarm(self._poolJobs, int(time.time())+10*60, [db_name])
+            cr = db.cursor()
         except:
             return False
+        
+        now = DateTime.now()
+        #FIXME: multidb. Solution: a l'instanciation d'une nouvelle connection bd (ds pooler) fo que j'instancie
+        # un nouveau pooljob avec comme parametre la bd
 
         try:
             cr.execute('select * from ir_cron where numbercall<>0 and active and nextcall<=now() order by priority')