Skip to content

Commit

Permalink
fix logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzha0 committed Jul 19, 2024
1 parent d47fd07 commit 599141f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 14 deletions.
7 changes: 1 addition & 6 deletions replit_river/client_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,6 @@ async def _create_new_session(

async def _retry_connection(self) -> ClientSession:
if not self._transport_options.transparent_reconnect:
print(
"connection dropped and transparent reconn is off, closing all sessions"
)
await self._close_all_sessions()
return await self._get_or_create_session()

Expand Down Expand Up @@ -295,20 +292,18 @@ async def _establish_handshake(
"Stream closed before response, closing connection",
)

logging.debug("river client waiting for handshake response")
startup_grace_sec = 60
try:
# listen even before we send
response_msg = await asyncio.wait_for(
self._get_handshake_response_msg(websocket), startup_grace_sec
)
handshake_response = ControlMessageHandshakeResponse(**response_msg.payload)
logging.debug("river client waiting for handshake response")
except ValidationError as e:
raise RiverException(
ERROR_HANDSHAKE, f"Failed to parse handshake response : {e}"
)
except asyncio.TimeoutError:
print(session_id, "TIMEOUT")
raise RiverException(
ERROR_HANDSHAKE, "Handshake response timeout, closing connection"
)
Expand Down
4 changes: 0 additions & 4 deletions replit_river/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ async def close_websocket(
return
await ws_wrapper.close()
if should_retry and self._retry_connection_callback:
print("retrying ws")
self._task_manager.create_task(self._retry_connection_callback())

async def _open_stream_and_call_handler(
Expand Down Expand Up @@ -522,7 +521,6 @@ async def close(self) -> None:
f"to {self._to_id}, ws: {self._ws_wrapper.id}, "
f"current_state : {self._ws_wrapper.ws_state.name}"
)
print("session closing", self.session_id)
async with self._state_lock:
if self._state != SessionState.ACTIVE:
# already closing
Expand All @@ -531,11 +529,9 @@ async def close(self) -> None:
self._reset_session_close_countdown()
await self._task_manager.cancel_all_tasks()

print("closing ws in close()")
await self.close_websocket(self._ws_wrapper, should_retry=False)

# Clear the session in transports
print("calling close session callback")
await self._close_session_callback(self)

# TODO: unexpected_close should close stream differently here to
Expand Down
4 changes: 0 additions & 4 deletions replit_river/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ async def close(self) -> None:
await self._close_all_sessions()

async def _close_all_sessions(self) -> None:
print("closing all sessions")
sessions = self._sessions.values()
logging.info(
f"start closing sessions {self._transport_id}, number sessions : "
Expand All @@ -51,13 +50,10 @@ async def _close_all_sessions(self) -> None:
logging.info(f"Transport closed {self._transport_id}")

async def _delete_session(self, session: Session) -> None:
print("deleting session", session.session_id)
async with self._session_lock:
if session._to_id in self._sessions:
del self._sessions[session._to_id]

print("SUCCESS!")

def _set_session(self, session: Session) -> None:
self._sessions[session._to_id] = session

Expand Down

0 comments on commit 599141f

Please sign in to comment.