Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge main into testnet7 #3710

Merged
merged 12 commits into from
May 4, 2021
Prev Previous commit
Next Next commit
Don't retry respond_peers message (#3508)
  • Loading branch information
mariano54 committed May 3, 2021
commit 5ce1bfc34c8c4e6221c8621404ea7a4c4358bad2
19 changes: 11 additions & 8 deletions chia/server/ws_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ async def inbound_handler(self):
self.log.error(f"Exception Stack: {error_stack}")

async def send_message(self, message: Message):
""" Send message sends a message with no tracking / callback. """
"""Send message sends a message with no tracking / callback."""
if self.closed:
return
await self.outgoing_queue.put(message)
Expand Down Expand Up @@ -346,13 +346,16 @@ async def _send_message(self, message: Message):
f"peer: {self.peer_host}"
)

async def wait_and_retry(msg: Message, queue: asyncio.Queue):
try:
await asyncio.sleep(1)
await queue.put(msg)
except Exception as e:
self.log.debug(f"Exception {e} while waiting to retry sending rate limited message")
return
# TODO: fix this special case. This function has rate limits which are too low.
if ProtocolMessageTypes(message.type) != ProtocolMessageTypes.respond_peers:

async def wait_and_retry(msg: Message, queue: asyncio.Queue):
try:
await asyncio.sleep(1)
await queue.put(msg)
except Exception as e:
self.log.debug(f"Exception {e} while waiting to retry sending rate limited message")
return

asyncio.create_task(wait_and_retry(message, self.outgoing_queue))
return
Expand Down