Bug fix
This commit is contained in:
parent
8a9126b729
commit
7266568010
1 changed files with 3 additions and 2 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
import os
|
import os
|
||||||
import typing
|
import typing
|
||||||
from datetime import date, datetime, time, timedelta, timezone
|
from datetime import date, datetime, time, timedelta, timezone
|
||||||
|
from time import time as unixtime
|
||||||
from zoneinfo import ZoneInfo
|
from zoneinfo import ZoneInfo
|
||||||
|
|
||||||
from .types import StrDict
|
from .types import StrDict
|
||||||
|
|
@ -113,12 +114,12 @@ async def time_function(
|
||||||
**kwargs: typing.Any,
|
**kwargs: typing.Any,
|
||||||
) -> tuple[str, typing.Any, float, Exception | None]:
|
) -> tuple[str, typing.Any, float, Exception | None]:
|
||||||
"""Time the execution of an asynchronous function."""
|
"""Time the execution of an asynchronous function."""
|
||||||
start_time, result, exception = time(), None, None
|
start_time, result, exception = unixtime(), None, None
|
||||||
try:
|
try:
|
||||||
result = await func(*args, **kwargs)
|
result = await func(*args, **kwargs)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exception = e
|
exception = e
|
||||||
end_time = time()
|
end_time = unixtime()
|
||||||
return name, result, end_time - start_time, exception
|
return name, result, end_time - start_time, exception
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue