Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
5324 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor

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

Related Posts Odpovědi Zobrazení Aktivita
3
říj 23
5748
2
led 23
5084
7
čvn 21
24416
11
zář 19
38187
0
úno 19
2797