Increase timeout of execution from scheduler for sync

Hi all,

I developing a frappe synchronize apps between erpnext and financial system. However, due to the large record need to be synced, the sync often crash at 300 second with error: JobTimeoutException: Job exceeded maximum timeout value (300 seconds).

When I execute from bench it’s ok, the system don’t drop the sync def. However, when use Scheduler, even I edit the supervisor.cfg, the problem still the same.

Can you let me know is there anyway to execute the function without timeout or longer timeout?

default timeout for scheduler event is 300 second, But you can use the hourly_long, daily_long events _long events have the timeout 1500 seconds.

You can check the timeout mapping for event in background_jobs.py

1 Like

Thank you for your solution, I end up to increase into 15600s to handle enough data per day.

enqueue(“jira_sync.api.sync_jira_resources”, queue=‘long’,timeout=15600)

However, there is other problems:

  1. Priority for process. Such as process gunicorn (front-end) is always higher than python or worker. , such gunicorn runing around 90% cpu, python only go down around 1-2%.

  2. MySQL: can we take seperate for the connection to MariaDB between worker and front-end? Currently, it will result in some error like this in peak time:

OperationalError: (1205, 'Lock wait timeout exceeded; try restarting transaction

Best Regards,

bench config http_timeout <value>
bench setup supervisor
bench setup nginx

Restart Services

Kindly note that this needs to be done as root. If you are not the root user, add sudo at the beginning of every command.

supervisorctl reload
service nginx reload