Skip to content

Commit a9575a8

Browse files
committed
add temporary timeout for debugging async jobs
1 parent 06fde28 commit a9575a8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/common-library/src/common_library/async_tools.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ def decorator(func: Callable[P, R]) -> Callable[P, Awaitable[R]]:
1515
@functools.wraps(func)
1616
async def wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
1717
loop = asyncio.get_running_loop()
18-
return await loop.run_in_executor(
19-
executor, functools.partial(func, *args, **kwargs)
20-
)
18+
return await asyncio.wait_for(
19+
loop.run_in_executor(
20+
executor, functools.partial(func, *args, **kwargs)
21+
),
22+
timeout=2,
23+
) # wait_for is temporary for debugging async jobs
2124

2225
return wrapper
2326

0 commit comments

Comments
 (0)