anchor.diff:      after 0 ->
           {updated, UserAcc}
       end.
  +
  +reset_heartbeat() ->
  +    put(last_changes_heartbeat,now()).
  +
  +maybe_heartbeat(Timeout, TimeoutFun, Acc) ->
  +    Now = now(),
  +    Before = get(last_changes_heartbeat),
  +    case Before of
  +    undefined ->
  +        {ok, Acc};
  +    _ ->
  +        case timer:now_diff(Now, Before) div 1000 >= Timeout of
  +        true ->
  +            Acc2 = TimeoutFun(Acc),
  +            put(last_changes_heartbeat, Now),
  +            Acc2;
  +        false ->
  +            {ok, Acc}
  +        end
  +    end.
  
positive.code:     end.
  
  
  keep_sending_changes(Args, Callback, UserAcc, Db, StartSeq, Prepend, Timeout,
      TimeoutFun, FirstRound) ->
      #changes_args{
          feed = ResponseType,
          limit = Limit,
  
negative.code: changes_enumerator(DocInfo, #changes_acc{resp_type = "continuous"} = Acc) ->
      #changes_acc{
          filter = FilterFun, callback = Callback,
          user_acc = UserAcc, limit = Limit, db = Db,
          timeout = Timeout, timeout_fun = TimeoutFun
      } = Acc,
      #doc_info{high_seq = Seq} = DocInfo,
      Results0 = FilterFun(Db, DocInfo),
      Results = [Result || Result <- Results0, Result /= null],
      %% TODO: I'm thinking this should be < 1 and not =< 1
      Go = if Limit =< 1 -> stop; true -> ok end,
      case Results of
      [] ->
          {Done, UserAcc2} = maybe_heartbeat(Timeout, TimeoutFun, UserAcc),
          case Done of
          stop ->
              {stop, Acc#changes_acc{seq = Seq, user_acc = UserAcc2}};
          ok ->
              {Go, Acc#changes_acc{seq = Seq, user_acc = UserAcc2}}
          end;
      _ ->
          ChangesRow = changes_row(Results, DocInfo, Acc),
          UserAcc2 = Callback({change, ChangesRow, <<>>}, "continuous", UserAcc),
          reset_heartbeat(),
          {Go, Acc#changes_acc{seq = Seq, user_acc = UserAcc2, limit = Limit - 1}}
      end;
  changes_enumerator(DocInfo, Acc) ->
      #changes_acc{
          filter = FilterFun, callback = Callback, prepend = Prepend,
          user_acc = UserAcc, limit = Limit, resp_type = ResponseType, db = Db,
          timeout = Timeout, timeout_fun = TimeoutFun
      } = Acc,
      #doc_info{high_seq = Seq} = DocInfo,
      Results0 = FilterFun(Db, DocInfo),
  