Skip to content

Commit

Permalink
Make receive method more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorjerse committed Jun 13, 2024
1 parent 903c23c commit 1f00b0e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions resolwe/flow/executors/socket_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,16 @@ async def start_listening(self):
received = await self._receive_message()

if received is None:
self.logger.info(
f"Communicator {self.name}: received empty message, closing communicator."
)
break
if self._terminating.is_set():
self.logger.info(
f"Communicator {self.name}: received empty message, closing communicator."
)
break
# Invalid message received, resume listening.
else:
continue

identity, message = received

if message.message_type is MessageType.HEARTBEAT:
logger.debug("Got heartbeat from peer '%s'.", identity)
if self.heartbeat_handler is not None:
Expand Down

0 comments on commit 1f00b0e

Please sign in to comment.