Skip to content

Commit

Permalink
Update to shackle 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lpgauth committed Jun 16, 2016
1 parent 90140ed commit 0b723fd
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{lz4, ".*", {git, "https://github.com/lpgauth/erlang-lz4.git",
{branch, "rebar3"}}},
{shackle, ".*", {git, "https://github.com/lpgauth/shackle.git",
{tag, "0.2.0"}}}
{tag, "0.3.1"}}}
]}.

{edoc_opts, [
Expand Down
12 changes: 10 additions & 2 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
[{<<"shackle">>,
[{<<"bear">>,
{git,"https://github.com/boundary/bear.git",
{ref,"119234548783af19b8ec75c879c5062676b92571"}},
2},
{<<"timing">>,
{git,"https://github.com/lpgauth/timing.git",
{ref,"b0a39694fd1d29a811a9a1120e96500a7c8d5d55"}},
1},
{<<"shackle">>,
{git,"https://github.com/lpgauth/shackle.git",
{ref,"b4587880a9c7502fc32f224252dbc8396f6ab93b"}},
{ref,"a5839cea433408446b0995ce6e37e7dce1d14aa8"}},
0},
{<<"lz4">>,
{git,"https://github.com/lpgauth/erlang-lz4.git",
Expand Down
26 changes: 0 additions & 26 deletions src/marina_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

-behavior(shackle_client).
-export([
options/0,
init/0,
setup/2,
handle_request/2,
Expand All @@ -24,31 +23,6 @@
-type state() :: #state {}.

%% shackle_server callbacks
-spec options() -> {ok, shackle:client_options()}.

options() ->
Ip = ?GET_ENV(ip, ?DEFAULT_IP),
Port = ?GET_ENV(port, ?DEFAULT_PORT),
Reconnect = ?GET_ENV(reconnect, ?DEFAULT_RECONNECT),
ReconnectTimeMax = ?GET_ENV(reconnect_time_max,
?DEFAULT_RECONNECT_MAX),
ReconnectTimeMin = ?GET_ENV(reconnect_time_min,
?DEFAULT_RECONNECT_MIN),

{ok, [
{ip, Ip},
{port, Port},
{reconnect, Reconnect},
{reconnect_time_max, ReconnectTimeMax},
{reconnect_time_min, ReconnectTimeMin},
{socket_options, [
binary,
{packet, raw},
{send_timeout, 50},
{send_timeout_close, true}
]}
]}.

-spec init() -> {ok, state()}.

init() ->
Expand Down
19 changes: 19 additions & 0 deletions src/marina_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,29 @@ start_link() ->

init([]) ->
BacklogSize = ?GET_ENV(backlog_size, ?DEFAULT_BACKLOG_SIZE),
Ip = ?GET_ENV(ip, ?DEFAULT_IP),
PoolSize = ?GET_ENV(pool_size, ?DEFAULT_POOL_SIZE),
PoolStrategy = ?GET_ENV(pool_strategy, ?DEFAULT_POOL_STRATEGY),
Port = ?GET_ENV(port, ?DEFAULT_PORT),
Reconnect = ?GET_ENV(reconnect, ?DEFAULT_RECONNECT),
ReconnectTimeMax = ?GET_ENV(reconnect_time_max,
?DEFAULT_RECONNECT_MAX),
ReconnectTimeMin = ?GET_ENV(reconnect_time_min,
?DEFAULT_RECONNECT_MIN),

ok = shackle_pool:start(?APP, ?CLIENT, [
{ip, Ip},
{port, Port},
{reconnect, Reconnect},
{reconnect_time_max, ReconnectTimeMax},
{reconnect_time_min, ReconnectTimeMin},
{socket_options, [
binary,
{packet, raw},
{send_timeout, 50},
{send_timeout_close, true}
]}
], [
{backlog_size, BacklogSize},
{pool_size, PoolSize},
{pool_strategy, PoolStrategy}
Expand Down

0 comments on commit 0b723fd

Please sign in to comment.