anchor.diff:  
   -define(MILLIS_PER_SEC, 1000).
   
  --record(state, {limit, remaining, interval, timer, name, pending}).
  +-record(state, {limit, remaining, interval, timer, name, pending, members, len}).
   
   %%%===================================================================
   %%% API
  
positive.code:                    remaining=LimitPerInterval,
                     interval=IntervalInMillis,
                     name=Name,
                     pending=queue:new()},
  
      alive(Name),
      {ok, schedule_refill(State)}.
  
negative.code:     To ! Reply,
      State#state{remaining=Rem-1};
  
  
  drain(#state{name=Name, members=Members} = State, Reply, To) ->
      case sets:is_element(To, Members) of
          false ->
              dropped(Name),
  
              Item = {Reply, To},
              Pending = queue:in(Item, State#state.pending),
              NewLen = State#state.len + 1,
              Members0 = sets:add_element(To, Members),
              State#state{pending=Pending, members=Members0, len=NewLen};
          true ->
              State
      end.
  
  
  dropped(Name) ->
      statser_instrumentation:increment(<<Name/binary, "-dropped">>).
  
  
  drain_queue(Queue, Members, 0) -> {Queue, Members, 0};
  drain_queue(Queue, Members, Remaining) ->
      case queue:out(Queue) of
          {empty, _Q} ->
              {Queue, Members, Remaining};
          {{value, {Reply, To}}, Q} ->
              To ! Reply,
              Members0 = sets:del_element(To, Members),
              drain_queue(Q, Members0, Remaining-1)
      end.
  