Closed scott-zhou closed 3 years ago
When the user calls the decorated sync method, it accepts a timeout argument to specify the maximum execution time.
Right you are! I had totally forgotten I had implemented this.
Returning None
is totally the wrong thing to do :)
I agree with your conclusion, and that a consistent exception should be raise, but I have no string opinion on which. If a custom exception, it should derive from asyncio.TimeoutError
Note that asyncio.TimeoutError
is a subclass of concurrent.futures.TimeoutError
Aha, no one can remember everything, it might be a bit long time ago :) I have changed the PR as you mentioned, the FSTimeoutError inheritance from asyncio.TimeoutError
asyn.sync_wrapper can convert an async method to a sync method. When the user calls the decorated sync method, it accepts a timeout argument to specify the maximum execution time.
When the timeout happen, it can be two different behaviors:
asyncio.wait_for()
, an asyncio.TimeoutError exception raisedthreading.Eveng.wait()
, the function will exit gracefully with None return value.This is a bit confusing and ambiguous result. For the first case, the user should not care about the fsspec's implementation detail, so it should not expect an asyncio.TimeoutError. And for the second case, the user doesn't know if the function actually succeeds but returns a None result, or it is timeout.
I think fsspec should have it's own user-defined exception FSTimeoutError and use that exception on either case of timeout.