Skip to content

Commit

Permalink
fix invalid cache expiry
Browse files Browse the repository at this point in the history
  • Loading branch information
meeuw committed Oct 16, 2020
1 parent afc502e commit e29bb47
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion aws_credential_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ def get_cached_session(cls, label):
cached_session["expiration"],
datetime.datetime.now(UTC) - margin,
)
if cached_session["expiration"] > (datetime.datetime.now(UTC) - margin):
# use cache: expiration > now + margin
# True: 2020-01-01 12:00:00 > 2020-01-01 11:00:00 + 10 seconds
# False: 2020-01-01 12:00:00 > 2020-01-01 11:59:51 + 10 seconds
if cached_session["expiration"] > (datetime.datetime.now(UTC) + margin):
return cls(
expiration=cached_session["expiration"],
awscred=AWSCred(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "aws-credential-process"
version = "0.6.0"
version = "0.7.0"
description = "AWS Credential Process"
authors = ["Dick Marinus <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit e29bb47

Please sign in to comment.