Skip to content

Commit 0ded5b6

Browse files
committed
[IMP] queue_job: disable queue with conf file
1 parent 697f0db commit 0ded5b6

4 files changed

Lines changed: 18 additions & 4 deletions

File tree

queue_job/README.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ Configuration
135135
``--http-interface`` or ``localhost`` if unset
136136
- ``ODOO_QUEUE_JOB_HTTP_AUTH_USER=jobrunner``, default empty
137137
- ``ODOO_QUEUE_JOB_HTTP_AUTH_PASSWORD=s3cr3t``, default empty
138+
- ``QUEUE_JOB__NO_DELAY=1``, disables the queue for testing purposes
138139
- Start Odoo with ``--load=web,queue_job`` and ``--workers`` greater
139140
than 1. [1]_
140141

@@ -155,6 +156,7 @@ Configuration
155156
port = 443
156157
http_auth_user = jobrunner
157158
http_auth_password = s3cr3t
159+
queue_job__no_delay=True # disables the queue
158160
159161
- Confirm the runner is starting correctly by checking the odoo log
160162
file:
@@ -481,7 +483,8 @@ running Odoo**
481483
When you are developing (ie: connector modules) you might want to bypass
482484
the queue job and run your code immediately.
483485

484-
To do so you can set QUEUE_JOB\__NO_DELAY=1 in your environment.
486+
To do so you can set QUEUE_JOB\__NO_DELAY=1 in your environment, or
487+
include queue_job\__no_delay=True in your Odoo server configuration.
485488

486489
**Bypass jobs in tests**
487490

@@ -599,7 +602,8 @@ calling ``jobs_tester.perform_enqueued_jobs()`` in your test.
599602
When you are developing (ie: connector modules) you might want to bypass
600603
the queue job and run your code immediately.
601604
602-
To do so you can set ``QUEUE_JOB__NO_DELAY=1`` in your environment.
605+
To do so you can set ``QUEUE_JOB__NO_DELAY=1`` in your environment, or
606+
include queue_job\__no_delay=True in your Odoo server configuration.
603607
604608
Warning
605609

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)