Skip to content

Commit

Permalink
full coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
bormilan committed Dec 30, 2024
1 parent 04bd221 commit 487b777
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
1 change: 0 additions & 1 deletion rebar.lock
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
[].
2 changes: 1 addition & 1 deletion src/epr.erl
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ run(Pids) ->
shutdown(AggServerPid, ProcessorPids) ->
Pids = [AggServerPid | ProcessorPids],
% gen_server:cast(AggServerPid, stop),
lists:map(fun(Pid) -> gen_server:cast(Pid, stop) end, Pids).
lists:map(fun(Pid) -> gen_server:call(Pid, stop) end, Pids).
10 changes: 5 additions & 5 deletions src/epr_data_aggregator_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ init(Param) ->

handle_cast({add_data, Id, Data}, State) ->
NewState = State#{Id => Data},
{noreply, NewState};
handle_cast(stop, State) ->
{stop, normal, State}.
{noreply, NewState}.

handle_call(get_state, _From, State) ->
{reply, State, State}.
{reply, State, State};
handle_call(stop, _, State) ->
{stop, normal, ok, State}.

terminate(normal, State) ->
io:format(user, "Processor terminated with state: ~p~n", [State]),
io:format(user, "Aggregator terminated with state: ~p~n", [State]),
ok.
8 changes: 3 additions & 5 deletions src/epr_processor_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ handle_cast(run, #{file_name := FileName, aggregator_server := AggServer} = Stat
gen_server:cast(AggServer, {add_data, FileName, ProcessedData})
end,

{noreply, State};
handle_cast(stop, State) ->
{stop, normal, State}.
{noreply, State}.

handle_call(_, _, State) ->
{reply, ok, State}.
handle_call(stop, _, State) ->
{stop, normal, ok, State}.

terminate(normal, State) ->
io:format(user, "Processor terminated with file name: ~p~n", [State]),
Expand Down

0 comments on commit 487b777

Please sign in to comment.