Skip to content

Commit

Permalink
Touch-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
mdwint committed May 20, 2021
1 parent a0a6695 commit 4525544
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "1.0.0rc1"
description = "CLI for creating a Python Package Repository in an S3 bucket"
authors = [
"Matteo De Wint <matteo@gorilla.co>",
"Ruben Van den Bossche <ruben@novemberfive.co>",
"Ruben Van den Bossche <ruben@gorilla.co>",
]

[tool.poetry.scripts]
Expand Down
6 changes: 3 additions & 3 deletions s3pypi/locking.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ def __init__(
self,
session: boto3.session.Session,
table: str,
poll_interval: int = 1,
retry_delay: int = 1,
max_attempts: int = 10,
):
db = session.resource("dynamodb")
self.table = db.Table(table)
self.exc = self.table.meta.client.exceptions
self.poll_interval = poll_interval
self.retry_delay = retry_delay
self.max_attempts = max_attempts
self.caller_id = session.client("sts").get_caller_identity()["Arn"]

Expand All @@ -71,7 +71,7 @@ def _lock(self, lock_id: str):
if attempt == 1:
log.info("Waiting to acquire lock... (%s)", lock_id)
if attempt < self.max_attempts:
time.sleep(self.poll_interval)
time.sleep(self.retry_delay)

item = self.table.get_item(Key={"LockID": lock_id})["Item"]
raise DynamoDBLockTimeoutError(self.table.name, item)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_locking.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def test_dynamodb_lock_timeout(boto3_session, dynamodb_table):
lock = DynamoDBLocker(
boto3_session,
dynamodb_table.name,
poll_interval=0.01,
retry_delay=0,
max_attempts=3,
)
key = "example"
Expand Down

0 comments on commit 4525544

Please sign in to comment.