-
Notifications
You must be signed in to change notification settings - Fork 12
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
Collection crashes randomly #9
Comments
@duhruh I haven't really been maintaining this project, but it's been in continuous operation for me with 3 batteries for a few years now. It's a dead simple driver which I liked over other options. I've been okay with TrippLites to date, but my experience writing drivers for vendor equipment is that some are more temperamental than others for no apparent reason. Regarding this, are you using the long polling sample code? state = None
def read_batteries(check_period=5):
"""Read battery and reopen in error. Use for long polling."""
battery = Battery()
battery.open()
while True:
time.sleep(check_period)
try:
state = battery.get()
except OSError:
logging.exception(f"Could not read battery {battery}.")
battery.close()
battery.open() This should be able to handle standard disconnects if the device isn't too finicky. EDIT Looks like you're running the prometheus exporter. If you're running this, you can try copy-pasting this reconnect logic into |
FWIW - I hit this and made a watchdog to just restart the service. It seems the device USB ID changes sometimes confusing the python or something along the lines. I've never been able to truly root cause and fix. Something is being cached I feel and as the prometheus exporter is long running the cached data becomes stale. But I haven't debugged it in a long time (years) but I remember the root cause fix being difficult for multiple reasons. |
Sorry, not sure if this project is still maintained, maybe you could just give me some pointers and I could patch it. I'm running into this error pretty frequently which requires a restart to mitigate, but then will happen again.
The text was updated successfully, but these errors were encountered: