Skip to content

Commit d90f600

Browse files
committed
[IMP] queue_job: disable queue with conf file
1 parent b4ec9b2 commit d90f600

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

queue_job/README.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ Configuration
105105
``--http-interface`` or ``localhost`` if unset
106106
- ``ODOO_QUEUE_JOB_HTTP_AUTH_USER=jobrunner``, default empty
107107
- ``ODOO_QUEUE_JOB_HTTP_AUTH_PASSWORD=s3cr3t``, default empty
108+
- ``QUEUE_JOB__NO_DELAY=1``, disables the queue for testing purposes
108109
- Start Odoo with ``--load=web,queue_job`` and ``--workers`` greater
109110
than 1. [1]_
110111

@@ -125,6 +126,7 @@ Configuration
125126
port = 443
126127
http_auth_user = jobrunner
127128
http_auth_password = s3cr3t
129+
queue_job__no_delay=True # disables the queue
128130
129131
- Confirm the runner is starting correctly by checking the odoo log
130132
file:
@@ -451,7 +453,8 @@ running Odoo**
451453
When you are developing (ie: connector modules) you might want to bypass
452454
the queue job and run your code immediately.
453455

454-
To do so you can set QUEUE_JOB\__NO_DELAY=1 in your environment.
456+
To do so you can set QUEUE_JOB\__NO_DELAY=1 in your environment, or
457+
include queue_job\__no_delay=True in your Odoo server configuration.
455458

456459
**Bypass jobs in tests**
457460

@@ -569,7 +572,8 @@ calling ``jobs_tester.perform_enqueued_jobs()`` in your test.
569572
When you are developing (ie: connector modules) you might want to bypass
570573
the queue job and run your code immediately.
571574
572-
To do so you can set ``QUEUE_JOB__NO_DELAY=1`` in your environment.
575+
To do so you can set ``QUEUE_JOB__NO_DELAY=1`` in your environment, or
576+
include queue_job\__no_delay=True in your Odoo server configuration.
573577
574578
Warning
575579

queue_job/readme/CONFIGURE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
or `localhost` if unset
99
- `ODOO_QUEUE_JOB_HTTP_AUTH_USER=jobrunner`, default empty
1010
- `ODOO_QUEUE_JOB_HTTP_AUTH_PASSWORD=s3cr3t`, default empty
11+
- `QUEUE_JOB__NO_DELAY=1`, disables the queue for testing purposes
1112
- Start Odoo with `--load=web,queue_job` and `--workers` greater than
1213
1.[^1]
1314
- Using the Odoo configuration file:
@@ -26,6 +27,7 @@ host = load-balancer
2627
port = 443
2728
http_auth_user = jobrunner
2829
http_auth_password = s3cr3t
30+
queue_job__no_delay=True # disables the queue
2931
```
3032

3133
- Confirm the runner is starting correctly by checking the odoo log

queue_job/readme/USAGE.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ running Odoo**
290290
When you are developing (ie: connector modules) you might want to bypass
291291
the queue job and run your code immediately.
292292

293-
To do so you can set QUEUE_JOB\_\_NO_DELAY=1 in your environment.
293+
To do so you can set QUEUE_JOB\_\_NO_DELAY=1 in your environment,
294+
or include queue_job__no_delay=True in your Odoo server configuration.
294295

295296
**Bypass jobs in tests**
296297

@@ -407,7 +408,8 @@ def test_method_to_test(self):
407408
When you are developing (ie: connector modules) you might want to bypass
408409
the queue job and run your code immediately.
409410

410-
To do so you can set `QUEUE_JOB__NO_DELAY=1` in your environment.
411+
To do so you can set `QUEUE_JOB__NO_DELAY=1` in your environment,
412+
or include queue_job__no_delay=True in your Odoo server configuration.
411413

412414
Warning
413415

queue_job/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import logging
55
import os
66

7+
from .jobrunner import queue_job_config
8+
79
_logger = logging.getLogger(__name__)
810

911

@@ -19,3 +21,7 @@ def must_run_without_delay(env):
1921
if env.context.get("queue_job__no_delay"):
2022
_logger.info("`queue_job__no_delay` ctx key found. NO JOB scheduled.")
2123
return True
24+
25+
if queue_job_config.get("queue_job__no_delay"):
26+
_logger.info("`queue_job__no_delay` server config found. NO JOB scheduled.")
27+
return True

0 commit comments

Comments
 (0)