mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 18:36:36 +00:00
timeout: Rename to unsafe_timeout.
This timeout strategy using asynchronous exceptions has a number of safety caveats (read the docstring!!) and should only be used in very specific circumstances. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
631c2f7d4c
commit
72018cc26b
@@ -22,7 +22,7 @@ class TimeoutExpiredError(Exception):
|
||||
ResultT = TypeVar("ResultT")
|
||||
|
||||
|
||||
def timeout(timeout: float, func: Callable[[], ResultT]) -> ResultT:
|
||||
def unsafe_timeout(timeout: float, func: Callable[[], ResultT]) -> ResultT:
|
||||
"""Call the function in a separate thread.
|
||||
Return its return value, or raise an exception,
|
||||
within approximately 'timeout' seconds.
|
||||
|
||||
Reference in New Issue
Block a user