Skip to content

Commit

Permalink
Merge pull request #59 from inaka/euen.57.58.fix_issues
Browse files Browse the repository at this point in the history
[Close #57][Close #58] :)
  • Loading branch information
Brujo Benavides authored May 31, 2017
2 parents 8492589 + be6fb84 commit f7de88a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 11 deletions.
8 changes: 5 additions & 3 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@

%% == Dependencies ==

{deps, [ {jiffy, "0.14.7"}
{deps, [ {jsx, "2.8.2"}
, {shotgun, "0.3.0"}
, {worker_pool, "1.0.4"}]}.
, {eper, "0.94.0"}
, {worker_pool, "2.2.3"}]}.

%% == Dialyzer ==

{dialyzer, [ {warnings, [ underspecs
{dialyzer, [ {warnings, [ race_conditions
, unknown
, no_return
, unmatched_returns
, error_handling
Expand Down
18 changes: 15 additions & 3 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
[{<<"cowlib">>,{pkg,<<"cowlib">>,<<"1.0.2">>},2},
{"1.1.0",
[{<<"cowlib">>,{pkg,<<"cowlib">>,<<"1.3.0">>},2},
{<<"eper">>,{pkg,<<"eper">>,<<"0.94.0">>},0},
{<<"gun">>,{pkg,<<"gun">>,<<"1.0.0-pre.1">>},1},
{<<"jiffy">>,{pkg,<<"jiffy">>,<<"0.14.7">>},0},
{<<"jsx">>,{pkg,<<"jsx">>,<<"2.8.2">>},0},
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.1.0">>},2},
{<<"shotgun">>,{pkg,<<"shotgun">>,<<"0.3.0">>},0},
{<<"worker_pool">>,{pkg,<<"worker_pool">>,<<"1.0.4">>},0}].
{<<"worker_pool">>,{pkg,<<"worker_pool">>,<<"2.2.3">>},0}]}.
[
{pkg_hash,[
{<<"cowlib">>, <<"6C80CA7F2863C0D7A21C946312BAF473432B56A79E46E20BC27A3BAC07C40439">>},
{<<"eper">>, <<"F5FB2DAA0DF8878748E1C598428EDA942A173E5121FF35C1D632129B84593A3A">>},
{<<"gun">>, <<"28514327A7572234633E127C1C14C5D91991BC26EC16D3707F05962A31F0C1B5">>},
{<<"jsx">>, <<"7ACC7D785B5ABE8A6E9ADBDE926A24E481F29956DD8B4DF49E3E4E7BCC92A018">>},
{<<"ranch">>, <<"F7ED6D97DB8C2A27CCA85CACBD543558001FC5A355E93A7BFF1E9A9065A8545B">>},
{<<"shotgun">>, <<"54EA3C243B65A935A3491A079A573C9D119A5EAF28BC2673893F8EEF66FDC053">>},
{<<"worker_pool">>, <<"2CD7B2C289B900940297D283922D7E119C540CB8F29B5254639ABB9BFB100CAE">>}]}
].
2 changes: 1 addition & 1 deletion src/tirerl.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{applications,
[kernel,
stdlib,
jiffy,
jsx,
shotgun,
worker_pool
]},
Expand Down
2 changes: 1 addition & 1 deletion src/tirerl_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ start_pool(Name, Opts) ->
WPoolOptions = [{overrun_warning, infinity},
{overrun_handler, {error_logger, warning_report}},
{workers, 50},
{worker, {tirerl_worker, [{Name, Opts}]}}
{worker, {tirerl_worker, Opts}}
],

PoolSpec = {Name,
Expand Down
4 changes: 2 additions & 2 deletions src/tirerl_worker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ do_request(Req, #{connection := Conn}) ->

Body1 = case Body of
Body when is_binary(Body) -> Body;
_ -> jiffy:encode(Body)
_ -> jsx:encode(Body)
end,

FullUri =
Expand All @@ -146,7 +146,7 @@ process_response({error, _} = Response) ->
Response;
process_response({ok, #{status_code := Status, body := Body} = Response}) ->
try
Json = jiffy:decode(Body, [return_maps]),
Json = jsx:decode(Body, [return_maps]),
case Status of
Status when Status < 400 ->
{ok, Json};
Expand Down
5 changes: 4 additions & 1 deletion test/tirerl_meta_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
]
}]).

-export([init_per_suite/1]).
-export([init_per_suite/1, end_per_suite/1]).

-type config() :: [{atom(), term()}].

-spec init_per_suite(config()) -> config().
init_per_suite(Config) -> [{application, tirerl} | Config].

-spec end_per_suite(config()) -> config().
end_per_suite(Config) -> Config.

0 comments on commit f7de88a

Please sign in to comment.