Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Add better resizing
Browse files Browse the repository at this point in the history
Always resize *up* after a connection iff the log buffer is smaller than
the current default value for the buffer.
  • Loading branch information
ferd committed Nov 11, 2013
1 parent ffe84cb commit 3386377
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/logplex_tcpsyslog_drain.erl
Expand Up @@ -561,8 +561,9 @@ target_send_size() ->
end. end.


maybe_resize(Buf) -> maybe_resize(Buf) ->
case logplex_msg_buffer:max_size(Buf) =:= ?SHRINK_BUF_SIZE of Default = default_buf_size(),
true -> logplex_msg_buffer:resize(default_buf_size(), Buf); case logplex_msg_buffer:max_size(Buf) < Default of
true -> logplex_msg_buffer:resize(Default, Buf);
false -> Buf false -> Buf
end. end.


Expand Down
2 changes: 2 additions & 0 deletions test/logplex_tcp_drain_SUITE.erl
Expand Up @@ -181,6 +181,8 @@ full_stack(Config) ->
{match, _} = re:run(Logs, "mymsg7"). {match, _} = re:run(Logs, "mymsg7").


shrink(Config) -> shrink(Config) ->
%% Use an explicitly larger default than whatever the suite sets
application:set_env(logplex, tcp_drain_buffer_size, 1024),
Msg = fun(M) -> {user, debug, logplex_syslog_utils:datetime(now), Msg = fun(M) -> {user, debug, logplex_syslog_utils:datetime(now),
"fakehost", "erlang", M} "fakehost", "erlang", M}
end, end,
Expand Down

0 comments on commit 3386377

Please sign in to comment.