Skip to content

Use [:noconnect] on all cross-node sends#14

Merged
twinn merged 1 commit intomainfrom
noconnect-fix
Apr 10, 2026
Merged

Use [:noconnect] on all cross-node sends#14
twinn merged 1 commit intomainfrom
noconnect-fix

Conversation

@twinn
Copy link
Copy Markdown
Owner

@twinn twinn commented Apr 10, 2026

Summary

  • Switches all cross-node sends from send/2 to :erlang.send/3 with the [:noconnect] option
  • Prevents the scope GenServer from inadvertently triggering node connections when a peer is disconnected
  • Matches the behaviour of Erlang's pg.erl
  • Messages to disconnected peers are silently dropped; the next :nodeup triggers a fresh discover/sync

Test plan

  • mix test — 13 doctests, 147 tests, 0 failures
  • mix credo --strict — no issues
  • mix dialyzer — 0 errors

Matches pg.erl's use of erlang:send/3 with [noconnect]. Without
this flag, send/2 to a disconnected peer triggers a connection
attempt that blocks the GenServer until the attempt times out or
succeeds. With [:noconnect], the message is silently dropped if the
peer isn't connected — the next nodeup will trigger a fresh
discover/sync anyway, so nothing is lost.

Applied to:
  - broadcast/2 (the main send loop for join/leave/update gossip)
  - init/1 discover broadcast to all known nodes
  - nodeup handler discover to the new node
  - handle_discover reply to a discovering peer
@twinn twinn merged commit c49415c into main Apr 10, 2026
6 checks passed
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