تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
5344 أدوات العرض

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
أكتوبر 23
5754
2
يناير 23
5099
Datetime in python تم الحل
7
يونيو 21
24438
11
سبتمبر 19
38200
0
فبراير 19
2808