İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
5325 Görünümler

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!

Avatar
Vazgeç
En İyi Yanıt

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.

Avatar
Vazgeç
Üretici

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

İlgili Gönderiler Cevaplar Görünümler Aktivite
3
Eki 23
5749
2
Oca 23
5086
7
Haz 21
24416
11
Eyl 19
38190
0
Şub 19
2799