콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
5451 화면

Hello everyone, I just want to know how to prevent odoo server timeout or continue a cron process even the odoo server was timed out in odoo 10. By the way, I am using odoo 10 webservice(odoo xml-rpc) in my cron job.


Thank you very much in advance! God bless!

아바타
취소
베스트 답변

To prevent Odoo server timeouts, you can try increasing the timeout limit in your Odoo configuration file. You can do this by adding the following line in the [options] section of your Odoo configuration file:

makefile  limit_time_real = 3600

This will set the timeout limit to 1 hour (3600 seconds). You can adjust the value as needed based on the duration of your cron job.

To continue a cron process even if the Odoo server times out or returns a 500 Internal Server Error, you can catch any exceptions that may occur during the execution of your cron job and handle them appropriately. For example, you can use a try and except block to catch any exceptions and log the error message or send an email notification.

Here's an example code snippet that demonstrates this approach:

python

import xmlrpc.client

# Odoo XML-RPC configuration
url = 'http://localhost:8069'
db = 'my_database'
username = 'admin'
password = 'admin'

common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
uid = common.authenticate(db, username, password, {})
models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url))

try:
# Your cron job code here
 
 
except Exception as e:
# Log the error message or send an email notification


By wrapping your code in a try and except block, you can catch any exceptions that may occur during the execution of your cron job and handle them appropriately. This will allow your cron job to continue running even if the Odoo server times out or returns a 500 Internal Server Error.

아바타
취소
작성자

Thank you very much Geek Boy. I really appreciate your effort to answer my question. I will try this.

관련 게시물 답글 화면 활동
3
10월 23
5834
2
1월 23
5183
Datetime in python 해결 완료
7
6월 21
24522
11
9월 19
38298
0
2월 19
2867