Merge pull request #1824 from lbryio/fix-ping-timeout

fix timeout error
This commit is contained in:
Jack Robison 2019-01-28 21:53:32 -05:00 committed by GitHub
commit 305034ffb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -100,6 +100,6 @@ class AsyncGeneratorJunction:
pass pass
finally: finally:
if exc_type: if exc_type:
if exc_type not in (asyncio.CancelledError, asyncio.TimeoutError, StopAsyncIteration): if exc_type not in (asyncio.CancelledError, asyncio.TimeoutError, StopAsyncIteration, GeneratorExit):
err = traceback.format_exception(exc_type, exc, tb) err = traceback.format_exception(exc_type, exc, tb)
log.error(err) log.error(err)

View file

@ -218,7 +218,7 @@ class PingQueue:
await self._protocol.add_peer(p) await self._protocol.add_peer(p)
return return
await self._protocol.get_rpc_peer(p).ping() await self._protocol.get_rpc_peer(p).ping()
except TimeoutError: except asyncio.TimeoutError:
pass pass
while True: while True:

View file

@ -2815,7 +2815,7 @@ class Daemon(metaclass=JSONRPCServerType):
try: try:
result = await peer.ping() result = await peer.ping()
return result.decode() return result.decode()
except TimeoutError: except asyncio.TimeoutError:
return {'error': 'ping timeout'} return {'error': 'ping timeout'}
@requires(DHT_COMPONENT) @requires(DHT_COMPONENT)