From e29bb47ffcdce0671faf686ee8b82e555998ac4f Mon Sep 17 00:00:00 2001 From: Dick Marinus Date: Fri, 16 Oct 2020 21:05:24 +0200 Subject: [PATCH] fix invalid cache expiry --- aws_credential_process.py | 5 ++++- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/aws_credential_process.py b/aws_credential_process.py index e24d8b6..2ab54a9 100755 --- a/aws_credential_process.py +++ b/aws_credential_process.py @@ -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( diff --git a/pyproject.toml b/pyproject.toml index 19ae06b..a91572c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] readme = "README.md"