Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable discovery of cluster nodes through DNS SRV #1337

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Clearly a bit rusty
  • Loading branch information
kocolosk committed Jan 15, 2018
commit ee62a92d46db8b69a09dc90a17f5f261510a6ec9
6 changes: 3 additions & 3 deletions src/mem3/src/mem3_dns.erl
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@ handle_call(_Call, _From, State) ->
{reply, ok, State}.

handle_cast(discover_peers, #state{max_tries = 0} = State) ->
{ok, State};
{noreply, State};

handle_cast(discover_peers, St) ->
case query_dns(St#state.record_name) of
{ok, Hostnames} ->
add_nodes(Hostnames),
{ok, St#state{discovered_names = Hostnames}};
{noreply, St#state{discovered_names = Hostnames}};
{error, Error} ->
#state{max_tries = Max, timeout = Timeout} = St,
NewSt = St#state{
last_error = Error,
max_tries = Max-1,
timeout = 2*Timeout
},
{ok, NewSt, Timeout}
{noreply, NewSt, Timeout}
end.

handle_info(timeout, State) ->
Expand Down