mirror of https://github.com/borgbackup/borg.git
fix checkpoints when clock jumps
This commit is contained in:
parent
a8d921a54c
commit
f5d6093ccc
|
@ -215,7 +215,7 @@ class Archive:
|
||||||
self.chunker = Chunker(self.key.chunk_seed, *chunker_params)
|
self.chunker = Chunker(self.key.chunk_seed, *chunker_params)
|
||||||
if name in manifest.archives:
|
if name in manifest.archives:
|
||||||
raise self.AlreadyExists(name)
|
raise self.AlreadyExists(name)
|
||||||
self.last_checkpoint = time.time()
|
self.last_checkpoint = time.monotonic()
|
||||||
i = 0
|
i = 0
|
||||||
while True:
|
while True:
|
||||||
self.checkpoint_name = '%s.checkpoint%s' % (name, i and ('.%d' % i) or '')
|
self.checkpoint_name = '%s.checkpoint%s' % (name, i and ('.%d' % i) or '')
|
||||||
|
@ -290,9 +290,9 @@ Number of files: {0.stats.nfiles}'''.format(
|
||||||
if self.show_progress:
|
if self.show_progress:
|
||||||
self.stats.show_progress(item=item, dt=0.2)
|
self.stats.show_progress(item=item, dt=0.2)
|
||||||
self.items_buffer.add(item)
|
self.items_buffer.add(item)
|
||||||
if time.time() - self.last_checkpoint > self.checkpoint_interval:
|
if time.monotonic() - self.last_checkpoint > self.checkpoint_interval:
|
||||||
self.write_checkpoint()
|
self.write_checkpoint()
|
||||||
self.last_checkpoint = time.time()
|
self.last_checkpoint = time.monotonic()
|
||||||
|
|
||||||
def write_checkpoint(self):
|
def write_checkpoint(self):
|
||||||
self.save(self.checkpoint_name)
|
self.save(self.checkpoint_name)
|
||||||
|
|
Loading…
Reference in New Issue