Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/exo/master/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,9 @@ async def _command_processor(self) -> None:

# These plan loops are the cracks showing in our event sourcing architecture - more things could be commands
async def _plan(self) -> None:
node_inactivity_timeout = timedelta(seconds=5)
tick_interval_seconds = 1.0

while True:
# kill broken instances
connected_node_ids = set(self.state.topology.list_nodes())
Expand All @@ -499,11 +502,11 @@ async def _plan(self) -> None:
# time out dead nodes
for node_id, time in self.state.last_seen.items():
now = datetime.now(tz=timezone.utc)
if now - time > timedelta(seconds=30):
if now - time > node_inactivity_timeout:
logger.info(f"Manually removing node {node_id} due to inactivity")
await self.event_sender.send(NodeTimedOut(node_id=node_id))

await anyio.sleep(10)
await anyio.sleep(tick_interval_seconds)

async def _event_processor(self) -> None:
with self.local_event_receiver as local_events:
Expand Down
4 changes: 3 additions & 1 deletion src/exo/worker/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ def _create_supervisor(self, task: CreateRunner) -> RunnerSupervisor:
return runner

async def _poll_connection_updates(self):
poll_interval_seconds = 2.0

while True:
edges = set(
conn.edge for conn in self.state.topology.out_edges(self.node_id)
Expand Down Expand Up @@ -487,4 +489,4 @@ async def _poll_connection_updates(self):
logger.debug(f"ping failed to discover {conn=}")
await self.event_sender.send(TopologyEdgeDeleted(conn=conn))

await anyio.sleep(10)
await anyio.sleep(poll_interval_seconds)
Loading