Skip to content

Commit

Permalink
Call connect after failed send
Browse files Browse the repository at this point in the history
  • Loading branch information
xjules committed Dec 18, 2024
1 parent c08cd48 commit 09fe2ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/_ert/forward_model_runner/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ async def send(self, message: str, retries: int | None = None) -> None:
logger.debug(
f"{self.dealer_id} connection to evaluator went down, reconnecting: {exc}"
)
await asyncio.sleep(1)
self.socket.connect(self.url)
except asyncio.CancelledError:
self.term()
raise
Expand All @@ -140,6 +138,8 @@ async def send(self, message: str, retries: int | None = None) -> None:
if retries > 0:
logger.info(f"Retrying... ({retries} attempts left)")
await asyncio.sleep(backoff)
# this call is idempotent
self.socket.connect(self.url)
backoff = min(backoff * 2, 10) # Exponential backoff
raise ClientConnectionError(
f"{self.dealer_id} Failed to send {message=} after {retries=}"
Expand Down

0 comments on commit 09fe2ae

Please sign in to comment.