diff --git a/queue_job/__manifest__.py b/queue_job/__manifest__.py index 5ee029c804..a5773a3c0c 100644 --- a/queue_job/__manifest__.py +++ b/queue_job/__manifest__.py @@ -2,7 +2,7 @@ { "name": "Job Queue", - "version": "15.0.2.3.0", + "version": "15.0.2.3.1", "author": "Camptocamp,ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/OCA/queue", "license": "LGPL-3", diff --git a/queue_job/jobrunner/runner.py b/queue_job/jobrunner/runner.py index 2314510731..4a574a68da 100644 --- a/queue_job/jobrunner/runner.py +++ b/queue_job/jobrunner/runner.py @@ -39,6 +39,7 @@ or ``False`` if unset. - ``ODOO_QUEUE_JOB_JOBRUNNER_DB_PASSWORD=passdb``, default ``db_password`` 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: @@ -54,6 +55,7 @@ http_auth_password = s3cr3t jobrunner_db_host = master-db jobrunner_db_port = 5432 + jobrunner_db_name = firstdb,seconddb jobrunner_db_user = userdb jobrunner_db_password = passdb @@ -398,7 +400,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) diff --git a/queue_job/tests/test_db_names.py b/queue_job/tests/test_db_names.py new file mode 100644 index 0000000000..7116ee6906 --- /dev/null +++ b/queue_job/tests/test_db_names.py @@ -0,0 +1,13 @@ +import os +from odoo.tests.common import TransactionCase +from odoo.tools import config + +class TestGetDbNames(TransactionCase): + + def test_get_db_names(self): + os.environ["ODOO_QUEUE_JOB_JOBRUNNER_DB_NAME"] = "db1,db2" + config["db_name"] = False + + db_names = self.env["queue.job"].get_db_names() + self.assertEqual(db_names, ["db1", "db2"]) +