wal-g: Use "start_time" field, not "time" which is S3 modified-at.

The `time` field is based on the file metadata in S3, which means that
touching the file contents in S3 can move backups around in the list.

Switch to using `start_time` as the sort key, which is based on the
contents of the JSON file stored as part of the backup, so is not
affected by changes in S3 metadata.
This commit is contained in:
Alex Vandiver 2023-07-19 16:49:30 -04:00 committed by Tim Abbott
parent 1accc6929e
commit 60ce5e1955
1 changed files with 1 additions and 1 deletions

View File

@ -106,7 +106,7 @@ class WalGPrometheusServer(BaseHTTPRequestHandler):
)
if len(data) > 0:
data.sort(key=lambda e: e["time"], reverse=True)
data.sort(key=lambda e: e["start_time"], reverse=True)
latest = data[0]
labels = {
"host": latest["hostname"],