Skip to content

Commit

Permalink
Don't require node IDs to parse as ints
Browse files Browse the repository at this point in the history
  • Loading branch information
dandavison committed Dec 10, 2024
1 parent 295bfde commit 99f5300
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions message_passing/safe_message_handlers/activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ClusterState:

@activity.defn
async def start_cluster() -> ClusterState:
return ClusterState(node_ids=[f"{i}" for i in range(25)])
return ClusterState(node_ids=[f"node-{i}" for i in range(25)])


@activity.defn
Expand Down Expand Up @@ -47,7 +47,7 @@ class FindBadNodesInput:
@activity.defn
async def find_bad_nodes(input: FindBadNodesInput) -> Set[str]:
await asyncio.sleep(0.1)
bad_nodes = set([n for n in input.nodes_to_check if int(n) % 5 == 0])
bad_nodes = set([id for id in input.nodes_to_check if hash(id) % 5 == 0])
if bad_nodes:
print(f"Found bad nodes: {bad_nodes}")
else:
Expand Down

0 comments on commit 99f5300

Please sign in to comment.