0

I have several large queries that I expect will return 50K+ records, but i seem to get consistent timeouts. I changed my query to SORT BY Id, as recommended in some posts, this worked for a while but they are timing out again.

my query processing code looks like:

               Task<QueryResult<T>> task = client.QueryAsync<T>(soql);


                var currentResultList = task.Result.Records;
                listCount += currentResultList.Count;
                task.Wait();
                while (!string.IsNullOrEmpty(task.Result.NextRecordsUrl))
                {
                    task = client.QueryContinuationAsync<T>(task.Result.NextRecordsUrl);
                    processCallback(currentResultList);
                    apiCount++;
                    task.Wait();
                    currentResultList = task.Result.Records;
                    listCount += currentResultList.Count;
                }
                processCallback(currentResultList);
            }
        }
        catch (Exception ex)
        {
            HandleException(ex, $"QueryAndProcess exception occurred for user {userName} for Query {soql} attempting to access {url}");
        }

I even tried to set the timeout on my own HTTP Client to 300 seconds but that make no difference, the exception occurs around 100-120 seconds.

                myClient = new HttpClient();
                myClient.Timeout = new TimeSpan(0,0,0,300);

                client = new ForceClient(instanceUrl, accessToken, apiVersion, myClient);

is there another way to set a longer timeout?

2 Answers 2

0

I don't know whether Salesforce will allow you to set longer timeouts. But when a query is timing out, it usually has to do with large record counts and query selectivity.

You haven't posted your soql query itself, but how many records are in your table? Are you querying using indexes? You can read more about selectivity here: http://resources.docs.salesforce.com/rel1/doc/en-us/static/pdf/salesforce_query_search_optimization_developer_cheatsheet.pdf

0

I am expecting 125k rows, 24 columns order by Id. I refactored the code to do two queries, and that works. I just need it to work for 6 months, by that time our system will no longer interface to SF.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .