mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-27 18:28:42 +00:00
AdHocCache: fix size not propagating to incref
This commit is contained in:
parent
8aa745ddbd
commit
fc7c560345
1 changed files with 4 additions and 4 deletions
|
@ -974,7 +974,7 @@ def add_chunk(self, id, chunk, stats, overwrite=False, wait=True):
|
|||
size = len(chunk)
|
||||
refcount = self.seen_chunk(id, size)
|
||||
if refcount:
|
||||
return self.chunk_incref(id, stats)
|
||||
return self.chunk_incref(id, stats, size_=size)
|
||||
data = self.key.encrypt(chunk)
|
||||
csize = len(data)
|
||||
self.repository.put(id, data, wait=wait)
|
||||
|
@ -985,12 +985,12 @@ def add_chunk(self, id, chunk, stats, overwrite=False, wait=True):
|
|||
def seen_chunk(self, id, size=None):
|
||||
return self.chunks.get(id, ChunkIndexEntry(0, None, None)).refcount
|
||||
|
||||
def chunk_incref(self, id, stats):
|
||||
def chunk_incref(self, id, stats, size_=None):
|
||||
if not self._txn_active:
|
||||
self._begin_txn()
|
||||
count, size, csize = self.chunks.incref(id)
|
||||
stats.update(size, csize, False)
|
||||
return ChunkListEntry(id, size, csize)
|
||||
stats.update(size or size_, csize, False)
|
||||
return ChunkListEntry(id, size or size_, csize)
|
||||
|
||||
def chunk_decref(self, id, stats, wait=True):
|
||||
if not self._txn_active:
|
||||
|
|
Loading…
Reference in a new issue