Sometimes I experience weird issue when loading Tasks over REST API using simple SELECT Id, ... FROM Task SOQL query take quite some time and then returns with nothing, but on the second try it returns page of Tasks.

I am using restforce gem to access REST API. I tried it using both default Net::HTTP and Typhoeus adapters, with the similar result.

Any ideas why that happens and how to overcome this?

UPDATE 10 Oct 2013 Looks like this happens exactly 2 minutes after starting an API request independent of timeout settings I set on HTTP client. Looks like Salesforce has a maximum of 2 minutes for any SOQL query. If it takes more than 2 minutes to get the result, it will just kill the request. I haven't found any direct explanation/documentation on that, but I've seen mentions of 2 minutes maximum in similar contexts:

  1. https://salesforce.stackexchange.com/a/1725/64
  2. http://www.salesforce.com/us/developer/docs/api_analytics/salesforce_analytics_rest_api.pdf
  3. http://boards.developerforce.com/t5/APIs-and-Integration/REST-API-gt-SOQL-QUERY-TIMEOUT-Issue/td-p/409511
  4. http://boards.developerforce.com/t5/General-Development/Query-Timeout-vs-Network-Timeout/td-p/7280
  5. http://community.cazoomi.com/cazoomi/topics/error_code_query_timeout -- apparently one can ask SF reps to lift up this timeout setting
  • sounds like in the first attempt something is timing out and the error is getting ignored.
    – superfell
    Oct 8, 2013 at 16:51
  • I agree, I just hoped someone already experienced that and knows the reason. But, looks like I have to dive deeper into this and see if this is something that breaks on client side, or actually SF API breaks a long connection like that Oct 8, 2013 at 17:02
  • the 2 minute query timeout should return a specific error, it doesn't just kill the connection
    – superfell
    Oct 10, 2013 at 17:12
  • That's true, but i suspect ruby http client library doesn't handle that correctly. Oct 11, 2013 at 2:07


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.