Skip to content
Browse files

Add better resizing

Always resize *up* after a connection iff the log buffer is smaller than
the current default value for the buffer.
  • Loading branch information...
1 parent ffe84cb commit 33863779304beab3e430ecce84c11e6393823a7b @ferd ferd committed Nov 11, 2013
Showing with 5 additions and 2 deletions.
  1. +3 −2 src/logplex_tcpsyslog_drain.erl
  2. +2 −0 test/logplex_tcp_drain_SUITE.erl
View
5 src/logplex_tcpsyslog_drain.erl
@@ -561,8 +561,9 @@ target_send_size() ->
end.
maybe_resize(Buf) ->
- case logplex_msg_buffer:max_size(Buf) =:= ?SHRINK_BUF_SIZE of
- true -> logplex_msg_buffer:resize(default_buf_size(), Buf);
+ Default = default_buf_size(),
+ case logplex_msg_buffer:max_size(Buf) < Default of
+ true -> logplex_msg_buffer:resize(Default, Buf);
false -> Buf
end.
View
2 test/logplex_tcp_drain_SUITE.erl
@@ -181,6 +181,8 @@ full_stack(Config) ->
{match, _} = re:run(Logs, "mymsg7").
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),
"fakehost", "erlang", M}
end,

0 comments on commit 3386377

Please sign in to comment.
Something went wrong with that request. Please try again.