anchor.diff:          _Otherwise -> ok
       end,
   
  -    {noreply, NewState};
  +    {noreply, reset_inactivity(NewState)};
   
   handle_cast(_Msg, State) ->
       {noreply, State}.
  
positive.code: 
  -define(MIN_CACHE_INTERVAL, 60).
  
  -record(state, {path, fspath, metadata, cache=[], cache_size=0}).
  
  %%%===================================================================
  %%% API
  
negative.code:     end.
  
  
  flush(#state{cache=[]} = State) ->
      State;
  flush(#state{cache=Cache, fspath=File} = State) ->
      lager:debug("flushing metric cache of ~p (~w entries)",
                  [State#state.path, State#state.cache_size]),
  
      case statser_whisper:update_points(File, Cache) of
          ok ->
              statser_instrumentation:increment(<<"committed-points">>, State#state.cache_size),
              statser_instrumentation:increment(<<"writes">>),
              State#state{cache=[], cache_size=0};
          _Error ->
              % archive is not existing (yet)
              % so dispatch a creation via rate-limiter
              request_create(),
              State
      end.
  
  
  reset_inactivity(#state{inactivity=Inactive} = State) ->
      % reset pending timer (if necessary)
      case Inactive of
          none -> ok;
          TimerRef -> erlang:cancel_timer(TimerRef, [{async, true}])
      end,
  
      % schedule new timer
      case State#state.metadata of
          #whisper_metadata{archives=[A | _]} ->
              IntervalMillis = A#whisper_archive.seconds * ?INACTIVITY_FACTOR * ?MILLIS_PER_SEC,
              Timer = erlang:send_after(IntervalMillis, self(), inactivity),
              State#state{inactivity=Timer};
          _Otherwise ->
              State#state{inactivity=none}
      end.
  
  
  %%
  %% TESTS
  %%
  