[IMP] gunicorn: installing modules with multiple processes works.
authorVo Minh Thu <vmt@openerp.com>
Wed, 8 Feb 2012 17:09:26 +0000 (18:09 +0100)
committerVo Minh Thu <vmt@openerp.com>
Wed, 8 Feb 2012 17:09:26 +0000 (18:09 +0100)
bzr revid: vmt@openerp.com-20120208170926-1ydiw27j560yv0vz

gunicorn.conf.py
openerp/addons/base/module/module.py
openerp/modules/registry.py

index 1eaebe4..99b3abb 100644 (file)
@@ -17,7 +17,7 @@ pidfile = '.gunicorn.pid'
 # Gunicorn recommends 2-4 x number_of_cpu_cores, but
 # you'll want to vary this a bit to find the best for your
 # particular work load.
-workers = 1
+workers = 10
 
 # Some application-wide initialization is needed.
 on_starting = openerp.wsgi.on_starting
index 1eb96c3..2eadb2f 100644 (file)
@@ -30,6 +30,7 @@ import urllib
 import zipfile
 import zipimport
 
+import openerp
 import openerp.modules as addons
 import pooler
 import release
@@ -344,6 +345,7 @@ class module(osv.osv):
         if to_install_ids:
             self.button_install(cr, uid, to_install_ids, context=context)
 
+        openerp.modules.registry.RegistryManager.signal_registry_change(cr.dbname)
         return dict(ACTION_DICT, name=_('Install'))
 
     def button_immediate_install(self, cr, uid, ids, context=None):
index 26e153f..d79c568 100644 (file)
@@ -143,6 +143,7 @@ class RegistryManager(object):
     # must be reloaded.
     # The `base_cache_signaling sequence` indicates all caches must be
     # invalidated (i.e. cleared).
+    # TODO per registry
     base_registry_signaling_sequence = 1
     base_cache_signaling_sequence = 1
 
@@ -279,10 +280,19 @@ class RegistryManager(object):
                 cr = openerp.sql_db.db_connect(db_name).cursor()
                 try:
                     pass
-                    # cr.execute("select nextval('base_registry_signaling')")
-                    # cls.base_cache_signaling to = result
+                    # cr.execute("select nextval('base_cache_signaling')")
+                    # cls.base_cache_signaling_sequence to = result
                 finally:
                     cr.close()
                 registry.reset_any_cache_cleared()
 
+    @classmethod
+    def signal_registry_change(cls, db_name):
+        cr = openerp.sql_db.db_connect(db_name).cursor()
+        try:
+            cr.execute("select nextval('base_registry_signaling')")
+        finally:
+            cr.close()
+        #cls.base_registry_signaling_sequence to = result
+
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: