Skip to content

Commit d71b671

Browse files
remove retry logic, redundant with botocore retry
1 parent fd9ad26 commit d71b671

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

awswrangler/s3/_delete.py

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
import datetime
44
import itertools
55
import logging
6-
import time
76
from typing import Any, Dict, List, Optional, Union
8-
from urllib.parse import unquote_plus as _unquote_plus
97

108
import boto3
119

12-
from awswrangler import _utils, exceptions
10+
from awswrangler import _utils
1311
from awswrangler._threading import _get_executor
1412
from awswrangler.distributed import ray_remote
1513
from awswrangler.s3._fs import get_botocore_valid_kwargs
@@ -36,9 +34,11 @@ def _delete_objects(
3634
bucket: str,
3735
keys: List[str],
3836
s3_additional_kwargs: Optional[Dict[str, Any]],
39-
attempt: int = 1,
4037
) -> None:
41-
client_s3: boto3.client = _utils.client(service_name="s3", session=boto3_session)
38+
client_s3: boto3.client = _utils.client(
39+
service_name="s3",
40+
session=boto3_session,
41+
)
4242
_logger.debug("len(keys): %s", len(keys))
4343
batch: List[Dict[str, str]] = [{"Key": key} for key in keys]
4444
if s3_additional_kwargs:
@@ -51,24 +51,6 @@ def _delete_objects(
5151
deleted: List[Dict[str, Any]] = res.get("Deleted", [])
5252
for obj in deleted:
5353
_logger.debug("s3://%s/%s has been deleted.", bucket, obj.get("Key"))
54-
errors: List[Dict[str, Any]] = res.get("Errors", [])
55-
internal_errors: List[str] = []
56-
for error in errors:
57-
_logger.debug("error: %s", error)
58-
if "Code" not in error or error["Code"] != "InternalError":
59-
raise exceptions.ServiceApiError(errors)
60-
internal_errors.append(_unquote_plus(error["Key"]))
61-
if len(internal_errors) > 0:
62-
if attempt > 5: # Maximum of 5 attempts (Total of 15 seconds)
63-
raise exceptions.ServiceApiError(errors)
64-
time.sleep(attempt) # Incremental delay (linear)
65-
_delete_objects(
66-
bucket=bucket,
67-
keys=internal_errors,
68-
boto3_session=boto3_session,
69-
s3_additional_kwargs=s3_additional_kwargs,
70-
attempt=(attempt + 1),
71-
)
7254

7355

7456
def delete_objects(

0 commit comments

Comments
 (0)