forked from LBRYCommunity/lbry-sdk
Merge pull request #2920 from lbryio/uploading-to-reflector-status
add `uploading_to_reflector` to `file_list` results
This commit is contained in:
commit
c8b7cd8862
3 changed files with 10 additions and 4 deletions
|
@ -109,7 +109,8 @@ def encode_file_doc():
|
||||||
'channel_claim_id': '(str) None if claim is not found or not signed',
|
'channel_claim_id': '(str) None if claim is not found or not signed',
|
||||||
'channel_name': '(str) None if claim is not found or not signed',
|
'channel_name': '(str) None if claim is not found or not signed',
|
||||||
'claim_name': '(str) None if claim is not found else the claim name',
|
'claim_name': '(str) None if claim is not found else the claim name',
|
||||||
'reflector_progress': '(int) reflector upload progress, 0 to 100'
|
'reflector_progress': '(int) reflector upload progress, 0 to 100',
|
||||||
|
'uploading_to_reflector': '(bool) set to True when currently uploading to reflector'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -309,7 +310,8 @@ class JSONResponseEncoder(JSONEncoder):
|
||||||
'confirmations': (best_height + 1) - tx_height if tx_height > 0 else tx_height,
|
'confirmations': (best_height + 1) - tx_height if tx_height > 0 else tx_height,
|
||||||
'timestamp': self.ledger.headers.estimated_timestamp(tx_height),
|
'timestamp': self.ledger.headers.estimated_timestamp(tx_height),
|
||||||
'is_fully_reflected': managed_stream.is_fully_reflected,
|
'is_fully_reflected': managed_stream.is_fully_reflected,
|
||||||
'reflector_progress': managed_stream.reflector_progress
|
'reflector_progress': managed_stream.reflector_progress,
|
||||||
|
'uploading_to_reflector': managed_stream.uploading_to_reflector
|
||||||
}
|
}
|
||||||
|
|
||||||
def encode_claim(self, claim):
|
def encode_claim(self, claim):
|
||||||
|
|
|
@ -74,7 +74,8 @@ class ManagedStream:
|
||||||
'saving',
|
'saving',
|
||||||
'finished_writing',
|
'finished_writing',
|
||||||
'started_writing',
|
'started_writing',
|
||||||
'finished_write_attempt'
|
'finished_write_attempt',
|
||||||
|
'uploading_to_reflector'
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, loop: asyncio.AbstractEventLoop, config: 'Config', blob_manager: 'BlobManager',
|
def __init__(self, loop: asyncio.AbstractEventLoop, config: 'Config', blob_manager: 'BlobManager',
|
||||||
|
@ -103,6 +104,7 @@ class ManagedStream:
|
||||||
|
|
||||||
self.fully_reflected = asyncio.Event(loop=self.loop)
|
self.fully_reflected = asyncio.Event(loop=self.loop)
|
||||||
self.reflector_progress = 0
|
self.reflector_progress = 0
|
||||||
|
self.uploading_to_reflector = False
|
||||||
self.file_output_task: typing.Optional[asyncio.Task] = None
|
self.file_output_task: typing.Optional[asyncio.Task] = None
|
||||||
self.delayed_stop_task: typing.Optional[asyncio.Task] = None
|
self.delayed_stop_task: typing.Optional[asyncio.Task] = None
|
||||||
self.streaming_responses: typing.List[typing.Tuple[Request, StreamResponse]] = []
|
self.streaming_responses: typing.List[typing.Tuple[Request, StreamResponse]] = []
|
||||||
|
@ -432,6 +434,7 @@ class ManagedStream:
|
||||||
sent = []
|
sent = []
|
||||||
protocol = StreamReflectorClient(self.blob_manager, self.descriptor)
|
protocol = StreamReflectorClient(self.blob_manager, self.descriptor)
|
||||||
try:
|
try:
|
||||||
|
self.uploading_to_reflector = True
|
||||||
await self.loop.create_connection(lambda: protocol, host, port)
|
await self.loop.create_connection(lambda: protocol, host, port)
|
||||||
await protocol.send_handshake()
|
await protocol.send_handshake()
|
||||||
sent_sd, needed = await protocol.send_descriptor()
|
sent_sd, needed = await protocol.send_descriptor()
|
||||||
|
@ -458,6 +461,7 @@ class ManagedStream:
|
||||||
finally:
|
finally:
|
||||||
if protocol.transport:
|
if protocol.transport:
|
||||||
protocol.transport.close()
|
protocol.transport.close()
|
||||||
|
self.uploading_to_reflector = False
|
||||||
if not self.fully_reflected.is_set():
|
if not self.fully_reflected.is_set():
|
||||||
self.fully_reflected.set()
|
self.fully_reflected.set()
|
||||||
await self.blob_manager.storage.update_reflected_stream(self.sd_hash, f"{host}:{port}")
|
await self.blob_manager.storage.update_reflected_stream(self.sd_hash, f"{host}:{port}")
|
||||||
|
|
|
@ -2,7 +2,7 @@ __node_daemon__ = 'lbrycrdd'
|
||||||
__node_cli__ = 'lbrycrd-cli'
|
__node_cli__ = 'lbrycrd-cli'
|
||||||
__node_bin__ = ''
|
__node_bin__ = ''
|
||||||
__node_url__ = (
|
__node_url__ = (
|
||||||
'https://github.com/lbryio/lbrycrd/releases/download/v0.17.4.4/lbrycrd-linux-1744.zip'
|
'https://github.com/lbryio/lbrycrd/releases/download/v0.17.4.5/lbrycrd-linux-1745.zip'
|
||||||
)
|
)
|
||||||
__spvserver__ = 'lbry.wallet.server.coin.LBCRegTest'
|
__spvserver__ = 'lbry.wallet.server.coin.LBCRegTest'
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue