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
Log exception of dropped retry
  • Loading branch information
janLo committed Nov 22, 2017
commit 1546cebb05a24d95d9b2537f51426671aaad574c
7 changes: 6 additions & 1 deletion homeassistant/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,18 @@ def scheduled(retry=0, untrack=None, event=None):
# pylint: disable=broad-except
try:
method(*args, **kwargs)
except Exception:
except Exception as ex:
if retry == self.retry_limit:
raise
if len(wrapper._retry_queue) >= self.queue_limit:
last = wrapper._retry_queue.pop(0)
if 'remove' in last:
func = last['remove']
func()
if 'exc' in last:
_LOGGER.error(
"Retry queue overflow, drop oldest entry",
last['exc'])

target = utcnow() + self.retry_delay
tracking = {'target': target}
Expand All @@ -379,6 +383,7 @@ def scheduled(retry=0, untrack=None, event=None):
tracking),
target)
tracking['remove'] = remove
tracking["exc"] = ex
wrapper._retry_queue.append(tracking)

scheduled()
Expand Down