Skip to content

Commit

Permalink
0.9.60 新增 timeout_decorator 装饰器
Browse files Browse the repository at this point in the history
  • Loading branch information
zengbin93 committed Oct 15, 2024
1 parent 06e93ce commit 4208c47
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions czsc/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,33 +231,6 @@ def to_arrow(df: pd.DataFrame):
return sink.getvalue()


# def timeout_decorator(timeout):
# """超时装饰器
#
# :param timeout: int, 超时时间,单位秒
# """
#
# def decorator(func):
# @functools.wraps(func)
# def wrapper(*args, **kwargs):
# from concurrent.futures import ThreadPoolExecutor, TimeoutError
#
# with ThreadPoolExecutor() as executor:
# future = executor.submit(func, *args, **kwargs)
# try:
# result = future.result(timeout=timeout)
# return result
# except TimeoutError:
# logger.warning(
# f"{func.__name__} timed out after {timeout} seconds;" f"args: {args}; kwargs: {kwargs}"
# )
# return None
#
# return wrapper
#
# return decorator


def timeout_decorator(timeout):
"""Timeout decorator using threading
Expand Down

0 comments on commit 4208c47

Please sign in to comment.