[FIX] pooler: when reloading registry, preserve the cron-active status of the previous registry

bzr revid: odo@openerp.com-20121221102910-wdrwom9k8sbhukmp
This commit is contained in:
Olivier Dony 2012-12-21 11:29:10 +01:00
parent 2839f96ffa
commit f349a6cbd3
1 changed files with 5 additions and 1 deletions

View File

@ -36,7 +36,11 @@ def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False,
def restart_pool(db_name, force_demo=False, status=None, update_module=False):
"""Delete an existing registry and return a database connection and a newly initialized registry."""
registry = RegistryManager.new(db_name, force_demo, status, update_module, True)
# preserve previous `cron-active` status of registry if it existed already
previous_registry = RegistryManager.registries.get(db_name)
cron_active = previous_registry and previous_registry.cron or False
registry = RegistryManager.new(db_name, force_demo, status, update_module, pooljobs=cron_active)
return registry.db, registry