-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated dev 4 9 24 (#36) * update reply show only changed data and logtime deco func add * consist of update response change gghnbackgroundtask and rean login once change * removed some comments and rectified set reminder resp msg * changed filename to logtime * changed date format to resolve issue of when date (#37)
- Loading branch information
1 parent
e945251
commit 8a062c3
Showing
16 changed files
with
175 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
class BaseResponseModel(BaseModel): | ||
Message : str | ||
Data : dict[str,int] | None | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import asyncio | ||
import time | ||
import logging | ||
import functools | ||
|
||
|
||
|
||
def log_execution_time(func): | ||
if asyncio.iscoroutinefunction(func): # Check if the function is async | ||
@functools.wraps(func) | ||
async def async_wrapper(*args, **kwargs): | ||
start_time = time.perf_counter() # Start time | ||
result = await func(*args, **kwargs) | ||
end_time = time.perf_counter() # End time | ||
execution_time = end_time - start_time | ||
logging.info(f"Executed {func.__name__} in {execution_time:.4f} seconds") | ||
return result | ||
return async_wrapper | ||
else: | ||
@functools.wraps(func) | ||
def sync_wrapper(*args, **kwargs): | ||
start_time = time.perf_counter() # Start time | ||
result = func(*args, **kwargs) | ||
end_time = time.perf_counter() # End time | ||
execution_time = end_time - start_time | ||
logging.info(f"Executed {func.__name__} in {execution_time:.4f} seconds") | ||
return result | ||
return sync_wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.