-
Notifications
You must be signed in to change notification settings - Fork 54
Stream reset on retry #284
Description
Hello there,
I am using the library, indirectly via python-storage, in maybe an unorthodox way: I am trying to implement a download timeout via a custom http adapter and response.
So my response object is throwing pro-actively timeouts (common.InvalidResponse with http.client.REQUEST_TIMEOUT),
which is forcibly triggering the retry logic in the Download class:
| def retriable_request(): |
All goes well, but one thing: the final results content data from both the partial content of prematurely aborted request and the final and complete data of the second request.
It happens because both dataset are accumulated in the _stream above.
Do you agree it's bug and that on retry the _stream shall be resetted (e.g. seek(0))? Do I miss a use case where it makes sense to accumulated data, or we were just assuming data would be empty anyway on exception?
If I did not miss anything I'll submit a PR to fix it.
Many thanks in advance.
Fred