summaryrefslogtreecommitdiff
path: root/odoo/service
diff options
context:
space:
mode:
authorDamien Bouvy <dbo@odoo.com>2020-04-17 10:08:10 +0000
committerXavier Morel <xmo@odoo.com>2020-08-05 14:09:28 +0000
commitfbf229941854987766875c7301ce1df74c7dcf48 (patch)
tree2998c6b9efea77d6d9263ef8c584891217ebcd70 /odoo/service
parentedbfa024d6e758efc9084bf25a31ad27eb78ed8f (diff)
[IMP] odoo: avoid warning regarding resource arg format
`struct_rusage.ru_utime` and `struct_rusage.ru_stime` are float seconds. `setrlimit()` takes a tuple of *integers*, and recent versions of Python have started triggering warnings: DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python. Convert the soft cpu time limit to an integer explicitly to suppress the warning. closes odoo/odoo#49710 Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
Diffstat (limited to 'odoo/service')
-rw-r--r--odoo/service/server.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/odoo/service/server.py b/odoo/service/server.py
index 52c91b5ed8a..87e9b8ddf42 100644
--- a/odoo/service/server.py
+++ b/odoo/service/server.py
@@ -952,7 +952,7 @@ class Worker(object):
r = resource.getrusage(resource.RUSAGE_SELF)
cpu_time = r.ru_utime + r.ru_stime
soft, hard = resource.getrlimit(resource.RLIMIT_CPU)
- resource.setrlimit(resource.RLIMIT_CPU, (cpu_time + config['limit_time_cpu'], hard))
+ resource.setrlimit(resource.RLIMIT_CPU, (int(cpu_time + config['limit_time_cpu']), hard))
def process_work(self):
pass