mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-24 08:19:03 +00:00
fix missing time_end metadata in old archives, fix updating end time
This commit is contained in:
parent
94451cd2e8
commit
73e15ac4a3
1 changed files with 7 additions and 2 deletions
|
@ -179,12 +179,15 @@ def load(self, id):
|
||||||
@property
|
@property
|
||||||
def ts(self):
|
def ts(self):
|
||||||
"""Timestamp of archive creation (start) in UTC"""
|
"""Timestamp of archive creation (start) in UTC"""
|
||||||
return parse_timestamp(self.metadata[b'time'])
|
ts = self.metadata[b'time']
|
||||||
|
return parse_timestamp(ts)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ts_end(self):
|
def ts_end(self):
|
||||||
"""Timestamp of archive creation (end) in UTC"""
|
"""Timestamp of archive creation (end) in UTC"""
|
||||||
return parse_timestamp(self.metadata[b'time_end'])
|
# fall back to time if there is no time_end present in metadata
|
||||||
|
ts = self.metadata.get(b'time_end') or self.metadata[b'time']
|
||||||
|
return parse_timestamp(ts)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def fpr(self):
|
def fpr(self):
|
||||||
|
@ -231,9 +234,11 @@ def save(self, name=None, timestamp=None):
|
||||||
raise self.AlreadyExists(name)
|
raise self.AlreadyExists(name)
|
||||||
self.items_buffer.flush(flush=True)
|
self.items_buffer.flush(flush=True)
|
||||||
if timestamp is None:
|
if timestamp is None:
|
||||||
|
self.end = datetime.utcnow()
|
||||||
start = self.start
|
start = self.start
|
||||||
end = self.end
|
end = self.end
|
||||||
else:
|
else:
|
||||||
|
self.end = timestamp
|
||||||
start = timestamp
|
start = timestamp
|
||||||
end = timestamp # we only have 1 value
|
end = timestamp # we only have 1 value
|
||||||
metadata = StableDict({
|
metadata = StableDict({
|
||||||
|
|
Loading…
Reference in a new issue