Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenthebuilder committed Apr 23, 2024
1 parent e2ae46d commit cebad6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name="replit-river"
version="0.1.7-beta.1"
version="0.1.7-beta.2"
description="Replit river toolkit for Python"
authors = ["Replit <[email protected]>"]
license = "LICENSE"
Expand Down
14 changes: 6 additions & 8 deletions replit_river/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ async def _heartbeat(
async def _send_buffered_messages(
self, websocket: websockets.WebSocketCommonProtocol
) -> None:
logging.debug(f"Sending buffered messages to {self._to_id}")
buffered_messages = list(self._buffer.buffer)
for msg in buffered_messages:
try:
Expand Down Expand Up @@ -338,6 +337,12 @@ async def send_message(
serviceName=service_name,
procedureName=procedure_name,
)
try:
await self._buffer.put(msg)
except Exception:
# We should close the session when there are too many messages in buffer
await self.close(True)
return
try:
await self._send_transport_message(
msg,
Expand All @@ -353,13 +358,6 @@ async def send_message(
logging.error(
f"Failed sending message : {e}, waiting for retry from buffer"
)
finally:
try:
await self._buffer.put(msg)
except Exception:
# We should close the session when there are too many messages in buffer
await self.close(True)
return

async def _send_responses_from_output_stream(
self,
Expand Down

0 comments on commit cebad6f

Please sign in to comment.