Skip to content

Commit

Permalink
Fixes /issues/240
Browse files Browse the repository at this point in the history
  • Loading branch information
MauriceBrg committed Apr 18, 2024
1 parent 85eb333 commit f66484b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/flask_session/dynamodb/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ def _create_table(self):
def _retrieve_session_data(self, store_id: str) -> Optional[dict]:
# Get the saved session (document) from the database
document = self.store.get_item(Key={"id": store_id}).get("Item")
if document:
session_is_not_expired = Decimal(datetime.utcnow().timestamp()) <= document.get(
"expiration"
)
if document and session_is_not_expired:
serialized_session_data = want_bytes(document.get("val").value)
return self.serializer.loads(serialized_session_data)
return None
Expand Down

0 comments on commit f66484b

Please sign in to comment.