Dealing with API requests timing out

My app uses CroQL to select the strings by certain criteria. For example, this is how I select strings that contain a given substring in an approved translation:

API endpoint: https://developer.crowdin.com/api/v2/#tag/Source-Strings/operation/api.projects.strings.getMany
croql parameter: count of translations where (language = @language:"lv" and text contains "substring" and count of approvals > 0) > 0

However, sometimes these requests time out (http status 400), here’s response body:

{
    "errors": [
        {
            "error": {
                "key": "croql",
                "errors": [
                    {
                        "code": "croqlTimeout",
                        "message": "Timed out while waiting for croql to execute"
                    }
                ]
            }
        }
    ]
}

It seems there’s a hard-coded 30 second timeout. Most of the time “retrying until it does not time out” approach works, but that’s really not a good UX.

I can understand that sometimes executing a CroQL query may take some toll on the servers, and perhaps user deserves a bad response if their query is very complex. But is there some way to at least change the timeout period?

Hi @Passiday ,

Yes, you’re right. There is a maximum execution time limit for requests with CroQL, this time is different for different requests. For the List Strings requests mentioned, this time is indeed 30s

We have one improvement task in our roadmap that is regarding requests with CroQL, so the team is working on it. Added your request to the task as well

1 Like