Fix to ensure youngest snapshot is retrieved rather than oldest (#3115)

This commit is contained in:
Rob 2016-04-13 07:21:58 +10:00 committed by René Moser
parent 52823bdb5b
commit 68c8669200

View file

@ -145,7 +145,7 @@ def _get_most_recent_snapshot(snapshots, max_snapshot_age_secs=None, now=None):
if not now:
now = datetime.datetime.utcnow()
youngest_snapshot = min(snapshots, key=_get_snapshot_starttime)
youngest_snapshot = max(snapshots, key=_get_snapshot_starttime)
# See if the snapshot is younger that the given max age
snapshot_start = datetime.datetime.strptime(youngest_snapshot.start_time, '%Y-%m-%dT%H:%M:%S.000Z')