Skip to content

Commit 714fd99

Browse files
committed
remove max hops limit from query
1 parent ef2ecd6 commit 714fd99

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

meshtastic_listener/__main__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,7 @@ def __traceroute_upstream__(self) -> None:
287287
self.__sleep_with_exit__(sleep_interval_minutes=15)
288288

289289
else:
290-
target = self.db.select_traceroute_target(
291-
fromId=self.local_node_id,
292-
maxHops=self.max_hops
293-
)
290+
target = self.db.select_traceroute_target(fromId=self.local_node_id)
294291
if not target:
295292
logging.warning("No valid traceroute nodes found in DB. Delaying next traceroute request for 1 hour.")
296293
self.__sleep_with_exit__(sleep_interval_minutes=60)

meshtastic_listener/listener_db/listener_db.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,10 +587,9 @@ def get_favorite_nodes(self) -> list[Node]:
587587
Node.lastHeard.desc()
588588
).all()
589589

590-
def select_traceroute_target(self, fromId: int, maxHops: int = 5) -> Node:
590+
def select_traceroute_target(self, fromId: int) -> Node:
591591
'''
592592
Returns 1 node (if any) if it is a favorite node or is another listener node,
593-
is less than maxHops hops away,
594593
is NOT the current node,
595594
and has not had a traceroute attempt (txTime) sent to it in the past 3 hours.
596595
'''
@@ -600,11 +599,10 @@ def select_traceroute_target(self, fromId: int, maxHops: int = 5) -> Node:
600599
Node
601600
).filter(
602601
(Node.isFavorite == True) | (Node.isHost == True),
603-
Node.hopsAway <= maxHops,
604602
Node.nodeNum != fromId,
605603
~Node.nodeNum.in_(
606604
session.query(Traceroute.toId).filter(
607-
Traceroute.txTime > three_hours_ago
605+
Traceroute.txTime >= three_hours_ago
608606
)
609607
)
610608
).order_by(

0 commit comments

Comments
 (0)