Ensure priority_limit_async_func_call decorator receive callable

This commit is contained in:
yangdx
2025-05-13 02:00:01 +08:00
parent 5c533f5e1a
commit 2845e268e4

View File

@@ -326,6 +326,9 @@ def priority_limit_async_func_call(max_size: int, max_queue_size: int = 1000):
"""
def final_decro(func):
# Ensure func is callable
if not callable(func):
raise TypeError(f"Expected a callable object, got {type(func)}")
queue = asyncio.PriorityQueue(maxsize=max_queue_size)
tasks = set()
initialization_lock = asyncio.Lock()