Skip to content
This repository has been archived by the owner on Jun 27, 2022. It is now read-only.

Add retry for write #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions homeassistant2influxdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,24 @@ def main():
batch_size_cur += 1

if batch_size_cur >= batch_size_max:
influx.write(batch_json)
while True:
try:
influx.write(batch_json)
except Exception as e:
print(e)
else:
break
batch_json = []
batch_size_cur = 0

influx.write(batch_json)

while True:
try:
influx.write(batch_json)
except Exception as e:
print(e)
else:
break
influx.close()

# print statistics - ideally you have one friendly name per entity_id
Expand Down