Skip to content

retry_rate_limited_request settings not working #385

@nissaint

Description

@nissaint

Instantiating balena with retry_rate_limited_request=True (e.g., balena = Balena({"retry_rate_limited_request": True})) does not trigger a retry when rate limit error is raised.

Observation:
The line self.__settings.get("retry_rate_limited_request") is True always evaluates to False, therefore a retry request is not executed

retry_after = req.headers.get("retry-after")
if (
self.__settings.get("retry_rate_limited_request") is True
and req.status_code == 429
and retry_after is not None
and retry_after.isdigit()
):
sleep(int(retry_after))
return self.__base_request(method, url, body)

Possible Cause:
self.__settings.get(<key>) returns a value as a string.
Hence, self.__settings.get("retry_rate_limited_request") returns 'True' as a string and not boolean.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions