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

Fix execute time logs #2367

Merged
merged 1 commit into from
Dec 25, 2021
Merged
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
9 changes: 4 additions & 5 deletions custom_components/hacs/tasks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from datetime import timedelta
from logging import Handler
from timeit import default_timer as timer
from time import monotonic

from homeassistant.core import HomeAssistant

Expand Down Expand Up @@ -45,7 +45,7 @@ async def execute_task(self, *_, **__) -> None:
)
return
self.task_logger(self.log.debug, "Executing task")
start_time = timer()
start_time = monotonic()

try:
if task := getattr(self, "execute", None):
Expand All @@ -56,7 +56,6 @@ async def execute_task(self, *_, **__) -> None:
self.task_logger(self.log.error, f"failed: {exception}")

else:
self.task_logger(
self.log.debug,
f"took {str(timer() - start_time)[:5]} seconds to complete",
self.log.debug(
"HacsTask<%s> took %.3f seconds to complete", self.slug, monotonic() - start_time
)