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

Commit 86ea230

Browse files
authored
Merge pull request #17 from GameAnalytics/nodeup
React on nodeup event to add node back
2 parents cea57ec + 298aa85 commit 86ea230

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/gascheduler.erl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,14 @@ handle_info({nodedown, NodeDown}, State = #state{nodes = Nodes}) ->
265265
%% from workers. Therefore, we can have a state where there are tasks still
266266
%% in the running queue but no nodes in the nodes list.
267267
{noreply, State#state{nodes = lists:delete(NodeDown, Nodes)}};
268+
handle_info({nodeup, Node}, State = #state{nodes = Nodes}) ->
269+
NewNodes = case lists:member(Node, Nodes) of
270+
true -> Nodes;
271+
false -> [Node | Nodes]
272+
end,
273+
error_logger:warning_msg("gascheduler: adding node ~p back to scheduler",
274+
[Node]),
275+
{noreply, State#state{nodes = NewNodes}};
268276
handle_info(Info, State) ->
269277
error_logger:warning_msg("gascheduler: unexpected message ~p", [Info]),
270278
{noreply, State}.

0 commit comments

Comments
 (0)