Hello everyone!
Someone knows how could I increase the timeout value of an API Request?
I'm doing a request to an API, but this service takes time to respond for the tasks it does and I get on console the error:
Currently this is my code:
Hello everyone!
Someone knows how could I increase the timeout value of an API Request?
I'm doing a request to an API, but this service takes time to respond for the tasks it does and I get on console the error:
Currently this is my code:
it that custom code, 'cos it should not take a long time to have a response back from the api, Ensure you have the correct query properly done, by increment the timeout it will not solve the problem. I would suggest to check what is the bottle neck of your application. Timeout also depents on your load balance if you have one or your server response time setup.
have a look here there you should have some info that you need
Rodrigo Manara
Sr. Developer
Hi Norberto,
You are likely restricted by either the apache timeout or the php timeout. In SugarCloud, the apache timeout is around 120 seconds (edited) and the php timeout is 3600 seconds - so your request is likely timing out waiting for a response from apache.
If you cannot make improvements to the code, you have a few options (in recommended order):
1) Redesign the code to be a scheduled job. This would allow your code to be executed by the cron at a later time, though if an immediate result is needed this may not work.
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_12.0/Architecture/Job_Queue/Jobs/
2) Redesign the request in a way that mimics the 12.x module loader progress bar (or the mass update/import progress bar). This would essentially be a repeating request that triggers your code to run and pings the server for updates on the progress of the script.
3) Increase the apache timeout - this cannot be done in SugarCloud and should be avoided as it can cause your application to hang if too many users have lasting connections.
I hope this gets you pointed in the right direction!