http_client: immediately raise cancelled errors

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-04-23 14:55:49 -04:00
parent 94a11ff291
commit cd520ba917
No known key found for this signature in database
GPG Key ID: 7027245FBBDDF59A
1 changed files with 2 additions and 0 deletions

View File

@ -274,6 +274,8 @@ class HttpClient:
header_callback=dl.on_headers_recd)
timeout = connect_timeout + request_timeout + 1.
resp = await asyncio.wait_for(fut, timeout)
except asyncio.CancelledError:
raise
except Exception:
if i + 1 == attempts:
raise