Skip to content

Commit

Permalink
Remove bad responses
Browse files Browse the repository at this point in the history
  • Loading branch information
drew2a committed May 8, 2023
1 parent aba30a7 commit cece7ab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/tribler/core/components/restapi/rest/events_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,17 @@ async def _write_data(self, message: MessageDict):
self._logger.exception(e)
return

processed_responses = []
for response in self.events_responses:
try:
await response.write(message_bytes)
# by creating the list with processed responses we want to remove responses with
# ConnectionResetError from `self.events_responses`:
processed_responses.append(response)
except ConnectionResetError as e:
# The connection was closed by GUI
self._logger.warning(e, exc_info=True)
self.events_responses = processed_responses

# An exception has occurred in Tribler. The event includes a readable
# string of the error and a Sentry event.
Expand Down

0 comments on commit cece7ab

Please sign in to comment.