-
-
Notifications
You must be signed in to change notification settings - Fork 560
Expand file tree
/
Copy pathutils.py
More file actions
27 lines (19 loc) · 794 Bytes
/
utils.py
File metadata and controls
27 lines (19 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright 2023 Camptocamp
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html)
import logging
import os
from .jobrunner import queue_job_config
_logger = logging.getLogger(__name__)
def must_run_without_delay(env):
"""Retrun true if jobs have to run immediately.
:param env: `odoo.api.Environment` instance
"""
if os.getenv("QUEUE_JOB__NO_DELAY"):
_logger.warning("`QUEUE_JOB__NO_DELAY` env var found. NO JOB scheduled.")
return True
if env.context.get("queue_job__no_delay"):
_logger.info("`queue_job__no_delay` ctx key found. NO JOB scheduled.")
return True
if queue_job_config.get("queue_job__no_delay"):
_logger.info("`queue_job__no_delay` server config found. NO JOB scheduled.")
return True