This commit is contained in:
Victor Shyba 2020-02-14 13:23:33 -03:00
parent 4d47873219
commit a2f8e7068e
5 changed files with 12 additions and 15 deletions

View file

@ -238,7 +238,7 @@ class FileManager:
# TODO: analytics for torrents
pass
elif self.analytics_manager and (error or (stream and (stream.downloader.time_to_descriptor or
stream.downloader.time_to_first_bytes))):
stream.downloader.time_to_first_bytes))):
server = self.wallet_manager.ledger.network.client.server
self.loop.create_task(
self.analytics_manager.send_time_to_first_bytes(

View file

@ -3,7 +3,6 @@ import asyncio
import time
import typing
import logging
import binascii
from typing import Optional
from aiohttp.web import Request, StreamResponse, HTTPRequestRangeNotSatisfiable
from lbry.error import DownloadSDTimeoutError

View file

@ -230,17 +230,17 @@ class StreamManager(SourceManager):
self.reflect_stream(stream)
return stream
async def delete(self, stream: ManagedStream, delete_file: Optional[bool] = False):
if stream.sd_hash in self.running_reflector_uploads:
self.running_reflector_uploads[stream.sd_hash].cancel()
stream.stop_tasks()
if stream.sd_hash in self.streams:
del self.streams[stream.sd_hash]
blob_hashes = [stream.sd_hash] + [b.blob_hash for b in stream.descriptor.blobs[:-1]]
async def delete(self, source: ManagedDownloadSource, delete_file: Optional[bool] = False):
if source.sd_hash in self.running_reflector_uploads:
self.running_reflector_uploads[source.sd_hash].cancel()
source.stop_tasks()
if source.sd_hash in self.streams:
del self.streams[source.sd_hash]
blob_hashes = [source.sd_hash] + [b.blob_hash for b in source.descriptor.blobs[:-1]]
await self.blob_manager.delete_blobs(blob_hashes, delete_from_db=False)
await self.storage.delete_stream(stream.descriptor)
if delete_file and stream.output_file_exists:
os.remove(stream.full_path)
await self.storage.delete_stream(source.descriptor)
if delete_file and source.output_file_exists:
os.remove(source.full_path)
async def stream_partial_content(self, request: Request, sd_hash: str):
return await self._sources[sd_hash].stream_file(request, self.node)

View file

@ -82,9 +82,6 @@ class TorrentManager(SourceManager):
super().__init__(loop, config, storage, analytics_manager)
self.torrent_session: 'TorrentSession' = torrent_session
def add(self, source: ManagedDownloadSource):
super().add(source)
async def recover_streams(self, file_infos: typing.List[typing.Dict]):
raise NotImplementedError

View file

@ -12,6 +12,7 @@ ignore_missing_imports = True
[pylint]
jobs=8
ignore=words,server,rpc,schema,winpaths.py,migrator,undecorated.py
extension-pkg-whitelist=libtorrent
max-parents=10
max-args=10
max-line-length=120