mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-23 06:31:58 +00:00
fix checkpoints when clock jumps
This commit is contained in:
parent
a8d921a54c
commit
f5d6093ccc
1 changed files with 3 additions and 3 deletions
|
@ -215,7 +215,7 @@ def __init__(self, repository, key, manifest, name, cache=None, create=False,
|
|||
self.chunker = Chunker(self.key.chunk_seed, *chunker_params)
|
||||
if name in manifest.archives:
|
||||
raise self.AlreadyExists(name)
|
||||
self.last_checkpoint = time.time()
|
||||
self.last_checkpoint = time.monotonic()
|
||||
i = 0
|
||||
while True:
|
||||
self.checkpoint_name = '%s.checkpoint%s' % (name, i and ('.%d' % i) or '')
|
||||
|
@ -290,9 +290,9 @@ def add_item(self, item):
|
|||
if self.show_progress:
|
||||
self.stats.show_progress(item=item, dt=0.2)
|
||||
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.last_checkpoint = time.time()
|
||||
self.last_checkpoint = time.monotonic()
|
||||
|
||||
def write_checkpoint(self):
|
||||
self.save(self.checkpoint_name)
|
||||
|
|
Loading…
Reference in a new issue