Skip to content

Commit

Permalink
Merge branch 'release/1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
yosukehara committed May 2, 2016
2 parents 2d26173 + 2a564d8 commit c435d35
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
6 changes: 4 additions & 2 deletions include/leo_ordning_reda.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@

-define(env_send_after_interval(),
case application:get_env(leo_ordning_reda, send_after_interval) of
{ok, _SendAfterInterval} -> _SendAfterInterval;
_ -> 100 %% 100msec
{ok, _SendAfterInterval} ->
_SendAfterInterval;
_ ->
0
end).

-define(env_temp_stacked_dir(),
Expand Down
1 change: 0 additions & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

{deps, [
{leo_commons, ".*", {git, "https://github.com/leo-project/leo_commons.git", {tag, "1.1.6"}}},
{lz4, ".*", {git, "https://github.com/leo-project/erlang-lz4.git", {tag, "0.2.2"}}},
{meck, ".*", {git, "https://github.com/eproxus/meck.git", {tag, "0.8.2"}}},
{proper, ".*", {git, "https://github.com/manopapad/proper.git", "1b773eeb47cb2c3116d78bdf681505703b762eee"}}
]}.
Expand Down
2 changes: 1 addition & 1 deletion src/leo_ordning_reda.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{application, leo_ordning_reda,
[
{description, "Leo ordning & reda"},
{vsn, "1.1.5"},
{vsn, "1.2.0"},
{registered, []},
{applications, [
kernel,
Expand Down
7 changes: 3 additions & 4 deletions src/leo_ordning_reda_api.erl
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,10 @@ pack(Object) ->

%% @doc Unpack the object
%%
-spec(unpack(CompressedBin, Fun) ->
ok when CompressedBin::binary(),
-spec(unpack(Bin, Fun) ->
ok when Bin::binary(),
Fun::function()).
unpack(CompressedBin, Fun) ->
{ok, Bin} = lz4:unpack(CompressedBin),
unpack(Bin, Fun) ->
unpack_1(Bin, Fun).

-spec(unpack_1(Bin, Fun) ->
Expand Down
20 changes: 8 additions & 12 deletions src/leo_ordning_reda_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@ handle_call({stack, Straw}, From, #state{unit = Unit,
{ok, #state{cur_size = CurSize,
stacked_obj = StackedObj,
stacked_info = StackedInfo} = NewState} when BufSize =< CurSize ->
timer:sleep(?env_send_after_interval()),
Interval = ?env_send_after_interval(),
case (Interval < 1) of
true ->
void;
false ->
timer:sleep(Interval)
end,
Pid = spawn(fun() ->
exec_fun(From, Module, Unit,
IsComp, StackedObj, StackedInfo)
Expand Down Expand Up @@ -356,17 +362,7 @@ exec_fun(From, Module, Unit, false, StackedObj, StackInf) ->
gen_server:reply(From, Reply);

exec_fun(From, Module, Unit, true, StackedObj, StackInf) ->
%% Compress object-list
Reply = case catch lz4:pack(StackedObj) of
{ok, CompressedObjs} ->
exec_fun_1(Module, Unit, CompressedObjs, StackInf);
{_, Cause} ->
error_logger:error_msg("~p,~p,~p,~p~n",
[{module, ?MODULE_STRING},
{function, "exec_fun/6"},
{line, ?LINE}, {body, Cause}]),
{error, element(1, Cause)}
end,
Reply = exec_fun_1(Module, Unit, StackedObj, StackInf),
gen_server:reply(From, Reply).


Expand Down

0 comments on commit c435d35

Please sign in to comment.