Skip to content

Commit

Permalink
[Storage] Revert removing aiohttp dependency for storage.blob.aio (#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenttran-msft authored Jul 6, 2022
1 parent 6d89670 commit 9f66f6b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
1 change: 0 additions & 1 deletion sdk/storage/azure-storage-blob/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
### Bugs Fixed
- Stable release of features from 12.13.0b1.
- Added support for deleting versions in `delete_blobs` by supplying `version_id`.
- Removed forced `aiohttp` import from storage async download. (#24965)

## 12.13.0b1 (2022-06-15)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from typing import AsyncIterator

import asyncio

from azure.core.exceptions import HttpResponseError, ServiceResponseError, IncompleteReadError
from aiohttp import ClientPayloadError
from azure.core.exceptions import HttpResponseError, ServiceResponseError

from .._shared.request_handlers import validate_and_format_range_headers
from .._shared.response_handlers import process_storage_error, parse_length_from_content_range
Expand Down Expand Up @@ -114,15 +114,14 @@ async def _download_chunk(self, chunk_start, chunk_end):
)
retry_active = False

except IncompleteReadError as error:
except HttpResponseError as error:
process_storage_error(error)
except ClientPayloadError as error:
retry_total -= 1
if retry_total <= 0:
raise ServiceResponseError(error, error=error)
await asyncio.sleep(1)

except HttpResponseError as error:
process_storage_error(error)

chunk_data = await process_content(response, offset[0], offset[1], self.encryption_options)


Expand Down Expand Up @@ -357,12 +356,6 @@ async def _initial_request(self):
self.size = self._file_size
retry_active = False

except IncompleteReadError as error:
retry_total -= 1
if retry_total <= 0:
raise ServiceResponseError(error, error=error)
await asyncio.sleep(1)

except HttpResponseError as error:
if self._start_range is None and error.response.status_code == 416:
# Get range will fail on an empty file. If the user did not
Expand All @@ -384,6 +377,12 @@ async def _initial_request(self):
else:
process_storage_error(error)

except ClientPayloadError as error:
retry_total -= 1
if retry_total <= 0:
raise ServiceResponseError(error, error=error)
await asyncio.sleep(1)

# get page ranges to optimize downloading sparse page blob
if response.properties.blob_type == 'PageBlob':
try:
Expand Down

0 comments on commit 9f66f6b

Please sign in to comment.