[IMP] openerp-server: catch db init errors to avoid exiting main thread

bzr revid: odo@openerp.com-20110923143223-4c9gofbml7w2gimo
This commit is contained in:
Olivier Dony 2011-09-23 16:32:23 +02:00
parent 029a636f4e
commit 008cc8e385
1 changed files with 5 additions and 2 deletions

View File

@ -88,8 +88,11 @@ def setup_pid_file():
def preload_registry(dbname):
""" Preload a registry, and start the cron."""
db, pool = openerp.pooler.get_db_and_pool(dbname, update_module=config['init'] or config['update'], pooljobs=False)
pool.get('ir.cron').restart(db.dbname)
try:
db, pool = openerp.pooler.get_db_and_pool(dbname, update_module=config['init'] or config['update'], pooljobs=False)
pool.get('ir.cron').restart(db.dbname)
except Exception:
logging.exception('Failed to initialize database `%s`.', dbname)
def run_test_file(dbname, test_file):
""" Preload a registry, possibly run a test file, and start the cron."""