I keep getting this “Query took too long and was canceled” error.
I will get this error any time that a function calls getSavedSearchResults(), even if the resulting dataset contains 0 items and no other operations are performed. Even more bizarrely, I only get this error the first
time I run my code. I can make a change to my code, refresh the associated URL, get the above error message, refresh again, and watch the exact same query succeed. Given that waiting for an hour or so will also “reset” the query, I suspect some sort of caching issue.
Why is this happening and how can I work around it? It makes scheduling cron tasks quite troublesome.
Saved search returns are limited to the time limit for the call on the IS server. So the more detailed or complex that saved search is, the longer it will take and the greater the chance of it timing out before that time to live expires.
Try simplifying the saved search parameters and then when you have a working one, build on it’s parameters to see how far you can go with it.
Hi @IT_Centerpointe, when you receive the “Query took too long and was cancelled” message, does it happen quickly or does it take several minutes before erroring? Either way it sounds like there’s a possible issue at hand so I would recommend submitting a support case so we can look into it further.
Thank you for the suggestion. Unfortunately, every saved search I run follows the same “time out first, then succeed when refreshed” pattern, whether it’s checking five tags and returning 700 users or 1 tag and 0 users. In this specific case, the error doesn’t seem to be related to the complexity of the query.
It happens after a few seconds, so about the same amount of time as it would take for the script to run successfully. I will also take your suggestion and submit a support ticket. Thank you!
It’s not what is returned that is the measure of the query. It’s the parameters that result in loops to search for what you are looking for. I’ve had it happen many times and reducing the complexity of the query in the saved search resolved the time out (though not the search I wanted).