mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-06 11:40:31 +00:00
Merge pull request #1066 from enkore/issue/1063
RepositoryCache: don't cache large objects
This commit is contained in:
commit
f974770db5
1 changed files with 5 additions and 1 deletions
|
@ -414,6 +414,9 @@ class RepositoryCache(RepositoryNoCache):
|
|||
|
||||
Caches Repository GET operations using a local temporary Repository.
|
||||
"""
|
||||
# maximum object size that will be cached, 64 kiB.
|
||||
THRESHOLD = 2**16
|
||||
|
||||
def __init__(self, repository):
|
||||
super().__init__(repository)
|
||||
tmppath = tempfile.mkdtemp(prefix='borg-tmp')
|
||||
|
@ -434,7 +437,8 @@ class RepositoryCache(RepositoryNoCache):
|
|||
except Repository.ObjectNotFound:
|
||||
for key_, data in repository_iterator:
|
||||
if key_ == key:
|
||||
self.caching_repo.put(key, data)
|
||||
if len(data) <= self.THRESHOLD:
|
||||
self.caching_repo.put(key, data)
|
||||
yield data
|
||||
break
|
||||
# Consume any pending requests
|
||||
|
|
Loading…
Add table
Reference in a new issue