forked from LBRYCommunity/lbry-sdk
logging
This commit is contained in:
parent
5119b71035
commit
0a66e1b24c
3 changed files with 5 additions and 3 deletions
|
@ -154,7 +154,9 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||||
log.info(msg)
|
log.info(msg)
|
||||||
msg = f"downloaded {self.blob.blob_hash[:8]} from {self.peer_address}:{self.peer_port}"
|
msg = f"downloaded {self.blob.blob_hash[:8]} from {self.peer_address}:{self.peer_port}"
|
||||||
await asyncio.wait_for(self.writer.finished, self.peer_timeout, loop=self.loop)
|
await asyncio.wait_for(self.writer.finished, self.peer_timeout, loop=self.loop)
|
||||||
log.info(msg + f" at {round((float(self._blob_bytes_received) / float(time.perf_counter() - start_time)) / 1000000.0, 2)}MB/s")
|
log.info("%s at %fMB/s", msg,
|
||||||
|
round((float(self._blob_bytes_received) /
|
||||||
|
float(time.perf_counter() - start_time)) / 1000000.0, 2))
|
||||||
# await self.blob.finished_writing.wait() not necessary, but a dangerous change. TODO: is it needed?
|
# await self.blob.finished_writing.wait() not necessary, but a dangerous change. TODO: is it needed?
|
||||||
return self._blob_bytes_received, self
|
return self._blob_bytes_received, self
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
|
|
|
@ -102,7 +102,7 @@ class BlobServerProtocol(asyncio.Protocol):
|
||||||
try:
|
try:
|
||||||
sent = await asyncio.wait_for(blob.sendfile(self), self.transfer_timeout, loop=self.loop)
|
sent = await asyncio.wait_for(blob.sendfile(self), self.transfer_timeout, loop=self.loop)
|
||||||
self.blob_manager.connection_manager.sent_data(self.peer_address_and_port, sent)
|
self.blob_manager.connection_manager.sent_data(self.peer_address_and_port, sent)
|
||||||
log.debug("sent %s (%i bytes) to %s:%i", bh, sent, peer_address, peer_port)
|
log.info("sent %s (%i bytes) to %s:%i", bh, sent, peer_address, peer_port)
|
||||||
except (ConnectionResetError, BrokenPipeError, RuntimeError, OSError, asyncio.TimeoutError) as err:
|
except (ConnectionResetError, BrokenPipeError, RuntimeError, OSError, asyncio.TimeoutError) as err:
|
||||||
if isinstance(err, asyncio.TimeoutError):
|
if isinstance(err, asyncio.TimeoutError):
|
||||||
log.debug("timed out sending blob %s to %s", bh, peer_address)
|
log.debug("timed out sending blob %s to %s", bh, peer_address)
|
||||||
|
|
|
@ -235,7 +235,7 @@ class Node:
|
||||||
peer.update_udp_port(udp_port_to_try)
|
peer.update_udp_port(udp_port_to_try)
|
||||||
self.loop.create_task(ping(peer))
|
self.loop.create_task(ping(peer))
|
||||||
else:
|
else:
|
||||||
log.debug("skip bad peer %s:%i for %s", blob_hash)
|
log.debug("skip bad peer %s:%i for %s", peer.address, peer.tcp_port, blob_hash)
|
||||||
if to_put:
|
if to_put:
|
||||||
result_queue.put_nowait(to_put)
|
result_queue.put_nowait(to_put)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue