Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #17 from GameAnalytics/nodeup
Browse files Browse the repository at this point in the history
React on nodeup event to add node back
  • Loading branch information
lastres authored Jun 7, 2018
2 parents cea57ec + 298aa85 commit 86ea230
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/gascheduler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,14 @@ handle_info({nodedown, NodeDown}, State = #state{nodes = Nodes}) ->
%% from workers. Therefore, we can have a state where there are tasks still
%% in the running queue but no nodes in the nodes list.
{noreply, State#state{nodes = lists:delete(NodeDown, Nodes)}};
handle_info({nodeup, Node}, State = #state{nodes = Nodes}) ->
NewNodes = case lists:member(Node, Nodes) of
true -> Nodes;
false -> [Node | Nodes]
end,
error_logger:warning_msg("gascheduler: adding node ~p back to scheduler",
[Node]),
{noreply, State#state{nodes = NewNodes}};
handle_info(Info, State) ->
error_logger:warning_msg("gascheduler: unexpected message ~p", [Info]),
{noreply, State}.
Expand Down

0 comments on commit 86ea230

Please sign in to comment.