Skip to content

Commit

Permalink
PISTON-315: correctly identify endpoint id during load_endpoints (260…
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfinke authored and jamesaimonetti committed Jun 2, 2020
1 parent 51ac54a commit dbbb411
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions applications/acdc/src/acdc_agent_fsm.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,7 @@ unmonitor_endpoint(EP, AccountId, AgentListener) ->

-spec maybe_add_endpoint(kz_term:ne_binary(), kz_json:object(), kz_json:objects(), kz_term:ne_binary(), kz_types:server_ref()) -> any().
maybe_add_endpoint(EPId, EP, EPs, AccountId, AgentListener) ->
case lists:partition(fun(E) -> kz_doc:id(E) =:= EPId end, EPs) of
case lists:partition(fun(E) -> find_endpoint_id(E) =:= EPId end, EPs) of
{[], _} ->
lager:debug("endpoint ~s not in our list, adding it", [EPId]),
[begin monitor_endpoint(EP, AccountId, AgentListener), EP end | EPs];
Expand All @@ -1783,7 +1783,7 @@ maybe_add_endpoint(EPId, EP, EPs, AccountId, AgentListener) ->

-spec maybe_remove_endpoint(kz_term:ne_binary(), kz_json:objects(), kz_term:ne_binary(), kz_types:server_ref()) -> kz_json:objects().
maybe_remove_endpoint(EPId, EPs, AccountId, AgentListener) ->
case lists:partition(fun(EP) -> kz_doc:id(EP) =:= EPId end, EPs) of
case lists:partition(fun(EP) -> find_endpoint_id(EP) =:= EPId end, EPs) of
{[], _} -> EPs; %% unknown endpoint
{[RemoveEP], EPs1} ->
lager:debug("endpoint ~s in our list, removing it", [EPId]),
Expand Down

0 comments on commit dbbb411

Please sign in to comment.