Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add thread timeout for loop.shutdown_default_executor #535

Merged
merged 2 commits into from
Oct 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions uvloop/loop.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3201,7 +3201,12 @@ cdef class Loop:

@cython.iterable_coroutine
async def shutdown_default_executor(self, timeout=None):
"""Schedule the shutdown of the default executor."""
"""Schedule the shutdown of the default executor.

The timeout parameter specifies the amount of time the executor will
be given to finish joining. The default value is None, which means
that the executor will be given an unlimited amount of time.
"""
self._executor_shutdown_called = True
if self._default_executor is None:
return
Expand All @@ -3214,7 +3219,7 @@ cdef class Loop:
thread.join(timeout)

if thread.is_alive():
warnings.warn(
warnings_warn(
"The executor did not finishing joining "
f"its threads within {timeout} seconds.",
RuntimeWarning,
Expand Down