Public Member Functions | |
| Callable | __call__ (self, Callable method) |
| None | __init__ (self, timedelta min_time, timedelta|None limit_no_throttle=None) |
Public Attributes | |
| limit_no_throttle | |
| min_time | |
A class for throttling the execution of tasks. This method decorator adds a cooldown to a method to prevent it from being called more than 1 time within the timedelta interval `min_time` after it returned its result. Calling a method a second time during the interval will return None. Pass keyword argument `no_throttle=True` to the wrapped method to make the call not throttled. Decorator takes in an optional second timedelta interval to throttle the 'no_throttle' calls. Adds a datetime attribute `last_call` to the method.
Definition at line 100 of file __init__.py.
| None homeassistant.util.Throttle.__init__ | ( | self, | |
| timedelta | min_time, | ||
| timedelta | None | limit_no_throttle = None |
||
| ) |
Initialize the throttle.
Definition at line 118 of file __init__.py.
| Callable homeassistant.util.Throttle.__call__ | ( | self, | |
| Callable | method | ||
| ) |
Caller for the throttle.
Definition at line 125 of file __init__.py.
| homeassistant.util.Throttle.limit_no_throttle |
Definition at line 123 of file __init__.py.
| homeassistant.util.Throttle.min_time |
Definition at line 122 of file __init__.py.