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:
- https://salesforce.stackexchange.com/a/1725/64
- http://www.salesforce.com/us/developer/docs/api_analytics/salesforce_analytics_rest_api.pdf
- http://boards.developerforce.com/t5/APIs-and-Integration/REST-API-gt-SOQL-QUERY-TIMEOUT-Issue/td-p/409511
- http://boards.developerforce.com/t5/General-Development/Query-Timeout-vs-Network-Timeout/td-p/7280
- http://community.cazoomi.com/cazoomi/topics/error_code_query_timeout -- apparently one can ask SF reps to lift up this timeout setting