Skip to content

Commit

Permalink
PISTON-1176: remove unused acdc_queue_manager start_link callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfinke committed Jan 14, 2021
1 parent b40ae98 commit 163c468
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 36 deletions.
32 changes: 2 additions & 30 deletions applications/acdc/src/acdc_queue_manager.erl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-behaviour(gen_listener).

%% API
-export([start_link/2, start_link/3
-export([start_link/3
,handle_member_call/2
,handle_member_call_success/2
,handle_member_call_cancel/2
Expand Down Expand Up @@ -118,18 +118,6 @@
%% @doc Starts the server.
%% @end
%%------------------------------------------------------------------------------
-spec start_link(pid(), kz_json:object()) -> kz_types:startlink_ret().
start_link(Super, QueueJObj) ->
AccountId = kz_doc:account_id(QueueJObj),
QueueId = kz_doc:id(QueueJObj),

gen_listener:start_link(?SERVER
,[{'bindings', ?BINDINGS(AccountId, QueueId)}
,{'responders', ?RESPONDERS}
]
,[Super, QueueJObj]
).

-spec start_link(pid(), kz_term:ne_binary(), kz_term:ne_binary()) -> kz_types:startlink_ret().
start_link(Super, AccountId, QueueId) ->
gen_listener:start_link(?SERVER
Expand Down Expand Up @@ -288,33 +276,17 @@ pick_winner(Srv, Resps) -> pick_winner(Srv, Resps, strategy(Srv), next_winner(Sr
%% @end
%%------------------------------------------------------------------------------
-spec init([pid() | kz_json:object() | kz_term:ne_binary()]) -> {'ok', mgr_state()}.
init([Super, QueueJObj]) ->
AccountId = kz_doc:account_id(QueueJObj),
QueueId = kz_doc:id(QueueJObj),

kz_util:put_callid(<<"mgr_", QueueId/binary>>),

init(Super, AccountId, QueueId, QueueJObj);

init([Super, AccountId, QueueId]) ->
kz_util:put_callid(<<"mgr_", QueueId/binary>>),

AcctDb = kz_util:format_account_id(AccountId, 'encoded'),
{'ok', QueueJObj} = kz_datamgr:open_cache_doc(AcctDb, QueueId),

init(Super, AccountId, QueueId, QueueJObj).

init(Super, AccountId, QueueId, QueueJObj) ->
process_flag('trap_exit', 'false'),

AccountDb = kz_util:format_account_id(AccountId, 'encoded'),
_ = kz_datamgr:add_to_doc_cache(AccountDb, QueueId, QueueJObj),

_ = start_secondary_queue(AccountId, QueueId),

gen_listener:cast(self(), {'start_workers'}),
Strategy = get_strategy(kz_json:get_value(<<"strategy">>, QueueJObj)),
StrategyState = create_strategy_state(Strategy, AccountDb, QueueId),
StrategyState = create_strategy_state(Strategy, AcctDb, QueueId),

_ = update_strategy_state(self(), Strategy, StrategyState),

Expand Down
12 changes: 6 additions & 6 deletions applications/acdc/src/acdc_queue_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
%% Supervisor callbacks
-export([init/1]).

-define(CHILDREN, [?SUPER('acdc_queue_workers_sup')
,?WORKER_ARGS('acdc_queue_manager', [self() | Args])
]).
-define(CHILDREN(Args), [?SUPER('acdc_queue_workers_sup')
,?WORKER_ARGS('acdc_queue_manager', [self() | Args])
]).

%%%=============================================================================
%%% api functions
Expand Down Expand Up @@ -81,15 +81,15 @@ status(Supervisor) ->
%% specifications.
%% @end
%%------------------------------------------------------------------------------
-spec init(list()) -> kz_types:sup_init_ret().
init(Args) ->
-spec init([kz_term:ne_binary(),...]) -> kz_types:sup_init_ret().
init([_AcctId, _QueueId]=Args) ->
RestartStrategy = 'one_for_all',
MaxRestarts = 2,
MaxSecondsBetweenRestarts = 2,

SupFlags = {RestartStrategy, MaxRestarts, MaxSecondsBetweenRestarts},

{'ok', {SupFlags, ?CHILDREN}}.
{'ok', {SupFlags, ?CHILDREN(Args)}}.

%%%=============================================================================
%%% Internal functions
Expand Down

0 comments on commit 163c468

Please sign in to comment.