mirror of https://github.com/borgbackup/borg.git
Document DownloadPipeline.unpack_many precautions
This commit is contained in:
parent
8268e26c6b
commit
b46713224b
|
@ -99,6 +99,15 @@ class DownloadPipeline:
|
|||
self.key = key
|
||||
|
||||
def unpack_many(self, ids, filter=None, preload=False):
|
||||
"""
|
||||
Return iterator of items.
|
||||
|
||||
*ids* is a chunk ID list of an item stream. *filter* is a callable
|
||||
to decide whether an item will be yielded. *preload* preloads the data chunks of every yielded item.
|
||||
|
||||
Warning: if *preload* is True then all data chunks of every yielded item have to be retrieved,
|
||||
otherwise preloaded chunks will accumulate in RemoteRepository and create a memory leak.
|
||||
"""
|
||||
unpacker = msgpack.Unpacker(use_list=False)
|
||||
for data in self.fetch_many(ids):
|
||||
unpacker.feed(data)
|
||||
|
|
|
@ -1329,11 +1329,11 @@ class RemoteArchiverTestCase(ArchiverTestCase):
|
|||
|
||||
def test_strip_components_doesnt_leak(self):
|
||||
self.cmd('init', self.repository_location)
|
||||
self.create_regular_file('dir/file', contents=b"test file contents 123")
|
||||
self.create_regular_file('dir/file2', contents=b"test file contents 345")
|
||||
self.create_regular_file('skipped', contents=b"test file contents 567")
|
||||
self.create_regular_file('skipped2', contents=b"test file contentsasdasd")
|
||||
self.create_regular_file('skipped4', contents=b"sdfdsgdgfhttztu")
|
||||
self.create_regular_file('dir/file', contents=b"test file contents 1")
|
||||
self.create_regular_file('dir/file2', contents=b"test file contents 2")
|
||||
self.create_regular_file('skipped-file1', contents=b"test file contents 3")
|
||||
self.create_regular_file('skipped-file2', contents=b"test file contents 4")
|
||||
self.create_regular_file('skipped-file3', contents=b"test file contents 5")
|
||||
self.cmd('create', self.repository_location + '::test', 'input')
|
||||
marker = 'cached responses left in RemoteRepository'
|
||||
with changedir('output'):
|
||||
|
|
Loading…
Reference in New Issue