|
| float|None | _Ts (self, Hashable key, float|None rate_limit, float now, Callable[[*_Ts], None] action, **_Ts args) |
| |
Class to track rate limits.
Definition at line 15 of file ratelimit.py.
◆ __init__()
| None homeassistant.helpers.ratelimit.KeyedRateLimit.__init__ |
( |
|
self, |
|
|
HomeAssistant |
hass |
|
) |
| |
Initialize ratelimit tracker.
Definition at line 18 of file ratelimit.py.
◆ _Ts()
| float | None homeassistant.helpers.ratelimit.KeyedRateLimit._Ts |
( |
|
self, |
|
|
Hashable |
key, |
|
|
float | None |
rate_limit, |
|
|
float |
now, |
|
|
Callable[[*_Ts], None] |
action, |
|
|
**_Ts |
args |
|
) |
| |
|
private |
Check rate limits and schedule an action if we hit the limit.
If the rate limit is hit:
Schedules the action for when the rate limit expires
if there are no pending timers. The action must
be called in async.
Returns the time the rate limit will expire
If the rate limit is not hit:
Return None
Definition at line 52 of file ratelimit.py.
◆ async_cancel_timer()
| None homeassistant.helpers.ratelimit.KeyedRateLimit.async_cancel_timer |
( |
|
self, |
|
|
Hashable |
key |
|
) |
| |
Cancel a rate limit time that will call the action.
Definition at line 39 of file ratelimit.py.
◆ async_has_timer()
| bool homeassistant.helpers.ratelimit.KeyedRateLimit.async_has_timer |
( |
|
self, |
|
|
Hashable |
key |
|
) |
| |
Check if a rate limit timer is running.
Definition at line 28 of file ratelimit.py.
◆ async_remove()
| None homeassistant.helpers.ratelimit.KeyedRateLimit.async_remove |
( |
|
self | ) |
|
◆ async_triggered()
| None homeassistant.helpers.ratelimit.KeyedRateLimit.async_triggered |
( |
|
self, |
|
|
Hashable |
key, |
|
|
float | None |
now = None |
|
) |
| |
Call when the action we are tracking was triggered.
Definition at line 33 of file ratelimit.py.
◆ hass
| homeassistant.helpers.ratelimit.KeyedRateLimit.hass |
The documentation for this class was generated from the following file: