Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InfluxDB send retry after IOError #10263

Merged
merged 17 commits into from
Nov 24, 2017
Merged
Prev Previous commit
Next Next commit
Make the linters happy
Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
  • Loading branch information
janLo committed Nov 22, 2017
commit 570eaaa72255b0f59297411460c1ebaec8dae193
8 changes: 5 additions & 3 deletions homeassistant/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,25 +327,27 @@ class RetryOnError(object):
It takes a Hass instance, a maximum number of retries and a retry delay
in seconds as arguments.
"""

def __init__(self, hass, retry_limit=0, retry_delay=20):
"""Initialize the decorator."""
self.hass = hass
self.retry_limit = retry_limit
self.retry_delay = timedelta(seconds=retry_delay)

def __call__(self, method):
"""This decorates the target method."""
"""Decorate the target method."""
from homeassistant.helpers.event import track_point_in_utc_time

@wraps(method)
def wrapper(*args, **kwargs):

"""Wrapped method."""
def scheduled(retry=0, event=None):
"""The scheduling wrapper.
"""Call the target method.

It is called directly at the first time and then called
scheduled within the Hass mainloop.
"""
# pylint: disable=broad-except
try:
method(*args, **kwargs)
except Exception:
Expand Down