Increase API timeout and improve logging

This commit is contained in:
Mariano
2021-03-15 15:30:53 +09:00
committed by Mariano Sorgente
parent 3972cc7f00
commit 95d42da37b
2 changed files with 7 additions and 3 deletions
+4 -2
View File
@@ -511,7 +511,7 @@ class ChiaServer:
connection.log.error(f"Exception: {e}, {connection.get_peer_info()}. {tb}")
raise e
response: Optional[Message] = await asyncio.wait_for(wrapped_coroutine(), timeout=300)
response: Optional[Message] = await asyncio.wait_for(wrapped_coroutine(), timeout=600)
connection.log.debug(
f"Time taken to process {message_type} from {connection.peer_node_id} is "
f"{time.time() - start_time} seconds"
@@ -523,7 +523,9 @@ class ChiaServer:
except Exception as e:
if self.connection_close_task is None:
tb = traceback.format_exc()
connection.log.error(f"Exception: {e}, closing connection {connection.get_peer_info()}. {tb}")
connection.log.error(
f"Exception: {e} {type(e)}, closing connection {connection.get_peer_info()}. {tb}"
)
else:
connection.log.debug(f"Exception: {e} while closing connection")
# TODO: actually throw one of the errors from errors.py and pass this to close
+3 -1
View File
@@ -203,9 +203,11 @@ class WSChiaConnection:
await self._send_message(msg)
except asyncio.CancelledError:
pass
except ConnectionResetError as e:
self.log.warning(f"{e} {self.peer_host}")
except Exception as e:
error_stack = traceback.format_exc()
self.log.error(f"Exception: {e}")
self.log.error(f"Exception: {e} with {self.peer_host}")
self.log.error(f"Exception Stack: {error_stack}")
async def inbound_handler(self):