Skip to content

Commit

Permalink
Fix execute time logs (#2367)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Dec 25, 2021
1 parent 1362523 commit f8d82c8
Showing 1 changed file with 4 additions and 5 deletions.
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
)

0 comments on commit f8d82c8

Please sign in to comment.