[FIX] deadlock between crons scheduling and new registry initialization creation
bzr revid: xmo@openerp.com-20110930150026-m0h99fqk6qgne8i1
This commit is contained in:
parent
d4d2b1b5b8
commit
6d70751dd7
|
@ -131,13 +131,11 @@ class RegistryManager(object):
|
|||
def get(cls, db_name, force_demo=False, status=None, update_module=False,
|
||||
pooljobs=True):
|
||||
""" Return a registry for a given database name."""
|
||||
with cls.registries_lock:
|
||||
if db_name in cls.registries:
|
||||
registry = cls.registries[db_name]
|
||||
else:
|
||||
registry = cls.new(db_name, force_demo, status,
|
||||
update_module, pooljobs)
|
||||
return registry
|
||||
try:
|
||||
return cls.registries[db_name]
|
||||
except KeyError:
|
||||
return cls.new(db_name, force_demo, status,
|
||||
update_module, pooljobs)
|
||||
|
||||
@classmethod
|
||||
def new(cls, db_name, force_demo=False, status=None,
|
||||
|
@ -172,10 +170,10 @@ class RegistryManager(object):
|
|||
finally:
|
||||
cr.close()
|
||||
|
||||
if pooljobs:
|
||||
registry.schedule_cron_jobs()
|
||||
if pooljobs:
|
||||
registry.schedule_cron_jobs()
|
||||
|
||||
return registry
|
||||
return registry
|
||||
|
||||
@classmethod
|
||||
def delete(cls, db_name):
|
||||
|
@ -218,4 +216,4 @@ class RegistryManager(object):
|
|||
cls.registries[db_name].clear_caches()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
Loading…
Reference in New Issue