Skip to content

fix(discovery): send several queries per round instead of one - #2

Merged
dodolia907 merged 1 commit into
mainfrom
fix/discovery-passes
Nov 22, 2026
Merged

dodolia907 merged 1 commit into
mainfrom
fix/discovery-passes

Conversation

@dodolia907

Copy link
Copy Markdown
Member

What

Found while running a real moip-toolkit node (avahi-daemon, as on utone-linux) next to moipctl's discovery: a single mDNS query is answered only about 70-80% of the time, so a round of ZeroconfBrowser often came back empty.

window rounds that found the node
4 s (old default) 7/10
8 s 6/10
1 s / 2 s / 3 s 16/20, 14/20, 14/20
6 s as 3 x 2 s (this PR) 30/30

The zeroconf library sends one query when a browse starts and the next one only after four seconds, so lengthening the window adds nothing. With the three-round TTL (--scout-ttl 45s) a 25% miss rate per round would take nodes offline from time to time.

Now a round is split into three short browses (a fresh query each), and the answers are merged (the latest answer per node ID wins). The default window grows from 4 s to 6 s so every pass gets 2 s; scout --window says so.

Testing

  • New unit tests: merging of passes, a node that only one pass sees, an error in a pass, a cancelled context.
  • Real avahi-daemon 0.8 (the toolkit's own container, test/node, in a separate PR): the 30/30 above.

Not covered: avahi's rate limiting on a real multi-host network may differ from one host.

🤖 Generated with Claude Code

The zeroconf library sends one query when a browse starts and the next one
four seconds later, so a longer window does not help. Against a real
avahi-daemon about a quarter of single queries went unanswered (7/10 rounds
with a 4 s window, 14/20 with 2 s and 3 s, 16/20 with 1 s), which with a
three-round TTL would take nodes offline now and then. A round is now split
into three short browses, each with a fresh query, and the answers are
merged: 30/30 rounds found the node. The default window grows from 4 s to
6 s (3 x 2 s).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@dodolia907
dodolia907 merged commit 596987a into main Nov 22, 2026
2 checks passed
@dodolia907

Copy link
Copy Markdown
Member Author

Merged (merge commit 596987a) and tagged v0.1.1 on it, as approved by the owner, so the cluster check can run with this fix: image.yml publishes ghcr.io/technotut/moipctl:0.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant