From 27604ec3ad77bb0b9cc43859bad5b74820145900 Mon Sep 17 00:00:00 2001 From: RLeeOSI <51208020+RLeeOSI@users.noreply.github.com> Date: Thu, 24 Mar 2022 19:53:53 -0700 Subject: [PATCH] [14.0][FIX] queue_job: support for multi-db environments --- queue_job/jobrunner/runner.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/queue_job/jobrunner/runner.py b/queue_job/jobrunner/runner.py index 8dbe39d97c..17df65391e 100644 --- a/queue_job/jobrunner/runner.py +++ b/queue_job/jobrunner/runner.py @@ -35,6 +35,7 @@ or ``False`` if unset. - ``ODOO_QUEUE_JOB_JOBRUNNER_DB_PORT=5432``, default ``db_port`` or ``False`` if unset. + - ``ODOO_QUEUE_JOB_JOBRUNNER_DB_NAME=firstdb,seconddb``, default ``db_name`` * Alternatively, configure the channels through the Odoo configuration file, like: @@ -50,6 +51,7 @@ http_auth_password = s3cr3t jobrunner_db_host = master-db jobrunner_db_port = 5432 + jobrunner_db_name = firstdb,seconddb * Or, if using ``anybox.recipe.odoo``, add this to your buildout configuration: @@ -390,7 +392,11 @@ def from_environ_or_config(cls): return runner def get_db_names(self): - if config["db_name"]: + if os.environ.get("ODOO_QUEUE_JOB_JOBRUNNER_DB_NAME"): + db_names = os.environ["ODOO_QUEUE_JOB_JOBRUNNER_DB_NAME"].split(",") + elif queue_job_config.get("jobrunner_db_name"): + db_names = queue_job_config["jobrunner_db_name"].split(",") + elif config["db_name"]: db_names = config["db_name"].split(",") else: db_names = odoo.service.db.exp_list(True)