From 34acc1c457d4cd4bbb316d2e1e538a1c2a06325c Mon Sep 17 00:00:00 2001 From: Noah Blumenthal Date: Tue, 6 Sep 2022 13:27:48 -0400 Subject: [PATCH] fix: support a timeout of size 0 --- python_dynamodb_lock/python_dynamodb_lock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python_dynamodb_lock/python_dynamodb_lock.py b/python_dynamodb_lock/python_dynamodb_lock.py index 5dbeec9a..5e6084ac 100644 --- a/python_dynamodb_lock/python_dynamodb_lock.py +++ b/python_dynamodb_lock/python_dynamodb_lock.py @@ -391,8 +391,8 @@ def acquire_lock(self, logger.info('Trying to acquire lock for: %s, %s', partition_key, sort_key) # plug in default values as needed - if not retry_period: retry_period = self._heartbeat_period - if not retry_timeout: retry_timeout = self._lease_duration + self._heartbeat_period + if retry_period is None: retry_period = self._heartbeat_period + if retry_timeout is None: retry_timeout = self._lease_duration + self._heartbeat_period # create the "new" lock that needs to be acquired new_lock = DynamoDBLock(