Skip to content

Commit

Permalink
Add two minute expiration buffer to TTLs
Browse files Browse the repository at this point in the history
  • Loading branch information
mconigliaro committed Feb 3, 2025
1 parent 0e0743a commit 91d7cee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## 1.2.0 - Pending

- Require Python >=3.9
- [aws] Add two minute expiration buffer to TTLs to prevent long-running
commands from failing by starting the renewal process early.

## 1.1.0 - 2022-10-18

Expand Down
3 changes: 2 additions & 1 deletion authum/plugins/aws/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class CacheableAWSObject(abc.ABC):

cache: ClassVar[AWSData] = AWSData()
expiration_timestamp: float = 0
expiration_buffer = datetime.timedelta(minutes=2)

@abc.abstractmethod
def load(self):
Expand All @@ -89,7 +90,7 @@ def ttl(self) -> datetime.timedelta:
except ValueError:
expiration = now

return expiration - now
return expiration - now - self.expiration_buffer

@property
def is_expired(self) -> bool:
Expand Down

0 comments on commit 91d7cee

Please sign in to comment.