+ Start a Discussion
John DayondonJohn Dayondon 

apex callout time out not changing to 120 sec

Hi,

I'm not sure what I'm doing wrong here but even if I set the timeout to 120secs or 60secs it still throws a time out exception after 10secs.

Here's the code that makes the call out. This code is used as a OnClick Javascript on my custom button.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    req.setMethod('GET');
    req.setTimeout(120000);
    
    try
    {
      HTTPResponse response = m_http.send(req);
      
     if(response.getBody() != null)
        return 'Success';
     else
        return 'Failed'; 
            
    } catch(System.CalloutException e) {
      return 'Error ' + e;
    }
------------------------------------------------------------------------------------------------------------------------------------------------------------

Is there somewhere else I need to set to make sure it uses the timeout set on the code?

Thanks for the help.

John DayondonJohn Dayondon
Hi Ankit,

Thanks for the response. I did tried changing the value of the time out parameter and it did changed the time the callout times out. Tried 2secs, 5secs then 10secs. But when I changed it to a value greater than 10secs, did 20secs and 30secs, the callout times out at 10secs.