Skip to content

Commit

Permalink
Add timeout when setting overwatcher heartbeat
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Jan 4, 2025
1 parent 3ae9d2e commit 3a15aac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

* Require two consecutive ping failures before restarting an actor.

### 🔧 Fixed

* Added a timeout to the `lvmbeat set overwatcher` command to prevent it from hanging indefinitely.


## 1.4.0 - January 1, 2025

Expand Down
11 changes: 10 additions & 1 deletion src/gort/overwatcher/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from lvmopstools.retrier import Retrier
from lvmopstools.utils import Trigger, with_timeout

from clu.tools import CommandStatus

from gort.overwatcher.core import OverwatcherModule, OverwatcherModuleTask
from gort.overwatcher.helpers import get_actor_ping, restart_actors
from gort.tools import decap
Expand All @@ -40,8 +42,15 @@ async def task(self):

while True:
try:
cmd = await self.gort.send_command("lvmbeat", "set overwatcher")
cmd = await self.gort.send_command(
"lvmbeat",
"set overwatcher",
time_limit=5,
)

if cmd.status.did_fail:
if cmd.status & CommandStatus.TIMEDOUT:
raise RuntimeError("Timed out setting overwatcher heartbeat.")
raise RuntimeError("Failed to set overwatcher heartbeat.")

except Exception as err:
Expand Down

0 comments on commit 3a15aac

Please sign in to comment.