forked from LBRYCommunity/lbry-sdk
download all blobs and check that on tests
This commit is contained in:
parent
fcbe8cf00b
commit
b1db42acf4
3 changed files with 8 additions and 1 deletions
|
@ -17,6 +17,7 @@ from lbry.dht.blob_announcer import BlobAnnouncer
|
|||
from lbry.blob.blob_manager import BlobManager
|
||||
from lbry.blob.disk_space_manager import DiskSpaceManager
|
||||
from lbry.blob_exchange.server import BlobServer
|
||||
from lbry.stream.managed_stream import ManagedStream
|
||||
from lbry.stream.stream_manager import StreamManager
|
||||
from lbry.file.file_manager import FileManager
|
||||
from lbry.extras.daemon.component import Component
|
||||
|
@ -421,6 +422,8 @@ class BackgroundDownloader(Component):
|
|||
stream = await file_manager.download_from_uri(
|
||||
claim.permanent_url, None, 60.0, save_file=False, wallet=wallet
|
||||
)
|
||||
if isinstance(stream, ManagedStream):
|
||||
await stream.save_blobs()
|
||||
amount -= 1
|
||||
if amount == 0:
|
||||
break
|
||||
|
|
|
@ -246,6 +246,10 @@ class ManagedStream(ManagedDownloadSource):
|
|||
handle.write(data)
|
||||
handle.flush()
|
||||
|
||||
async def save_blobs(self):
|
||||
async for _ in self._aiter_read_stream(0, connection_id=self.STREAMING_ID):
|
||||
pass
|
||||
|
||||
async def _save_file(self, output_path: str):
|
||||
log.info("save file for lbry://%s#%s (sd hash %s...) -> %s", self.claim_name, self.claim_id, self.sd_hash[:6],
|
||||
output_path)
|
||||
|
|
|
@ -576,7 +576,7 @@ class DiskSpaceManagement(CommandTestCase):
|
|||
class TestProactiveDownloaderComponent(CommandTestCase):
|
||||
async def assertFileList(self, *txos):
|
||||
txos_names = {txo['outputs'][0]['name'] for txo in txos}
|
||||
files = await self.file_list()
|
||||
files = await self.file_list(blobs_remaining=0)
|
||||
self.assertEqual(len(txos), len(files))
|
||||
file_claim_names = {file['claim_name'] for file in files}
|
||||
self.assertSetEqual(txos_names, file_claim_names)
|
||||
|
|
Loading…
Reference in a new issue