Reduce number of iqair request (#47890)
parent
fea944bcea
commit
4d61f6f8c2
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue