Skip to content

Adopt the exponential back-off to the rate limiter#193

Merged
sveinse merged 1 commit intocustom-components:masterfrom
sveinse:feature-adopt-backoff-to-rate-limiter
Jul 14, 2025
Merged

Adopt the exponential back-off to the rate limiter#193
sveinse merged 1 commit intocustom-components:masterfrom
sveinse:feature-adopt-backoff-to-rate-limiter

Conversation

@sveinse
Copy link
Collaborator

@sveinse sveinse commented Jul 14, 2025

As a follow-up of #190, adopt the exponential back-off mechanism to account for the time the rate limiter might delay the retries.

@sveinse sveinse merged commit dc4cef3 into custom-components:master Jul 14, 2025
1 check passed
@sveinse sveinse deleted the feature-adopt-backoff-to-rate-limiter branch July 14, 2025 21:55
sleep_delay = delay - time.perf_counter() + start_time
if sleep_delay > 0:
if DEBUG_API_CALLS:
_LOGGER.debug("Sleeping for %1.1f seconds", sleep_delay)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With 0.01 as the initial delay, won't this just print out 0.0, or am I just too tired? Shouldn't we use %.2f instead? (the minimum width of 1 is enforced by the number of decimals anyway)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I'll put this into the next update

@sveinse sveinse added this to the v0.8 milestone Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants