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.