Reduce number of iqair request (#47890)

pull/47906/head
jugla 2021-03-14 16:04:08 +01:00 committed by GitHub
parent fea944bcea
commit 4d61f6f8c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -80,9 +80,9 @@ def async_get_cloud_api_update_interval(hass, api_key, num_consumers):
This will shift based on the number of active consumers, thus keeping the user
under the monthly API limit.
"""
# Assuming 10,000 calls per month and a "smallest possible month" of 28 days; note
# Assuming 10,000 calls per month and a "largest possible month" of 31 days; note
# that we give a buffer of 1500 API calls for any drift, restarts, etc.:
minutes_between_api_calls = ceil(1 / (8500 / 28 / 24 / 60 / num_consumers))
minutes_between_api_calls = ceil(num_consumers * 31 * 24 * 60 / 8500)
LOGGER.debug(
"Leveling API key usage (%s): %s consumers, %s minutes between updates",