anchor.diff:                                                  notify, Size),
       State#state{buf = Buf}.
   
  -maybe_resize(Status, Buf) ->
  -    case Status of
  -        normal ->
  -            ok;
  -        degraded ->
  -            logplex_drain_buffer:resize_msg_buffer(Buf, default_buf_size())
  -    end.
  +maybe_resize(State0=#state{ service=normal }) ->
  +    State0#state{ last_good_time=os:timestamp() };
  +maybe_resize(State0=#state{ service=degraded }) ->
  +    State = State0#state{last_good_time=os:timestamp(), service=normal},
  +    ?INFO("drain_id=~p channel_id=~p dest=~s at=maybe_resize"
  +          " service=normal buf_size=~p",
  +          log_info(State, [default_buf_size()])),
  +    State.
   
   maybe_shrink(State = #state{last_good_time=never}) ->
       ?INFO("drain_id=~p channel_id=~p dest=~s at=maybe_shrink"
  -          " service=~p last_good_time=~p",
  +          " service=~p time_since_last_good=~p",
             log_info(State, [degraded, never])),
       State#state{service=degraded};
   maybe_shrink(State = #state{buf=Buf, service=Status, last_good_time=LastGood}) ->
  -    case {(now_to_msec(LastGood) < now_to_msec(os:timestamp())-?SHRINK_TIMEOUT),
  -                   Status} of
  +    MsecSinceLastGood = trunc(timer:now_diff(os:timestamp(), LastGood) / 1000),
  +    case {MsecSinceLastGood > ?SHRINK_TIMEOUT, Status} of
           {true, normal} ->
               ?INFO("drain_id=~p channel_id=~p dest=~s at=maybe_shrink"
  -                  " service=~p last_good_time=~s",
  -                  log_info(State, [degraded, logplex_utils:format_utc_timestamp(LastGood)])),
  +                  " service=~p time_since_last_good=~p",
  +                  log_info(State, [degraded, MsecSinceLastGood])),
               logplex_drain_buffer:resize_msg_buffer(Buf, ?SHRINK_BUF_SIZE),
               State#state{service=degraded};
  -        {_, _} ->
  +        {_, Status} ->
               ?INFO("drain_id=~p channel_id=~p dest=~s at=maybe_shrink"
  -                  " service=~p last_good_time=~s",
  -                  log_info(State, [normal, logplex_utils:format_utc_timestamp(LastGood)])),
  -            State#state{service=normal}
  +                  " service=~p time_since_last_good=~p",
  +                  log_info(State, [Status, MsecSinceLastGood])),
  +            State#state{service=Status}
       end.
   
  -now_to_msec({Mega,Sec,_}) -> (Mega*1000000 + Sec)*1000.
  -
   default_buf_size() -> logplex_app:config(http_drain_buffer_size, 1024).
  
positive.code: 
  -export([user_agent/0
           ,drain_buf_framing/1
           ,backoff_slots/1
          ]).
  
  %% ------------------------------------------------------------------
  
negative.code:             ready_to_send(NewTimerState#state{client=Pid,
                                                connect_time=ConnectEnd,
                                                reconnect_attempt=0});
          ignore ->
              http_fail(State);
          Why ->
              ConnectEnd = os:timestamp(),
              ?WARN("drain_id=~p channel_id=~p dest=~s at=try_connect "
  