Skip to content

Commit

Permalink
Trying to fix issue #78 - error during initialization
Browse files Browse the repository at this point in the history
Trying to fix issue #79 - error during retry connection
  • Loading branch information
ualex73 committed Nov 20, 2021
1 parent b881de0 commit 4129503
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion custom_components/monitor_docker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def RunDocker(hass, entry):
if entry[CONF_RETRY] == 0:
raise
else:
_LOGGER.error("%s", err)
_LOGGER.error("%s", str(err))
_LOGGER.error("Retry in %d seconds", entry[CONF_RETRY])
time.sleep(entry[CONF_RETRY])

Expand Down
5 changes: 3 additions & 2 deletions custom_components/monitor_docker/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def __init__(self, hass, config, startCount=0):
url = url.replace("unix://", "unix:///")

# When we reconnect with tcp, we should delay - docker is maybe not fully ready
if startCount > 0 and url.find("unix:") != 0:
if startCount > 0 and url is not None and url.find("unix:") != 0:
time.sleep(5)

# Do some debugging logging for TCP/TLS
Expand Down Expand Up @@ -938,7 +938,8 @@ async def _run_container_stats(self):
cache = raw["memory_stats"]["stats"]["inactive_file"]

memory_stats["usage"] = toMB(
raw["memory_stats"]["usage"] - cache, self._config[CONF_PRECISION_MEMORY_MB]
raw["memory_stats"]["usage"] - cache,
self._config[CONF_PRECISION_MEMORY_MB],
)
memory_stats["limit"] = toMB(
raw["memory_stats"]["limit"], self._config[CONF_PRECISION_MEMORY_MB]
Expand Down

0 comments on commit 4129503

Please sign in to comment.