anchor.diff:          resp_type = ResponseType,
           limit = Limit,
           include_docs = IncludeDocs,
  -        conflicts = Conflicts
  -    },
  +        conflicts = Conflicts,
  +        timeout = Timeout,
  +        timeout_fun = TimeoutFun
  +    }.
  +
  +send_changes(Args, Acc0, FirstRound) ->
  +    #changes_args{
  +        dir = Dir,
  +        filter = FilterName,
  +        filter_args = FilterArgs
  +    } = Args,
  +    #changes_acc{
  +        db = Db,
  +        seq = StartSeq
  +    } = Acc0,
       case FirstRound of
       true ->
           case FilterName of
  
positive.code:         end_sending_changes(Callback, UserAcc2, EndSeq, ResponseType);
      true ->
          case wait_db_updated(Timeout, TimeoutFun, UserAcc2) of
          {updated, UserAcc3} ->
              % ?LOG_INFO("wait_db_updated updated ~p",[{Db#db.name, EndSeq}]),
              DbOptions1 = [{user_ctx, Db#db.user_ctx} | DbOptions],
              case couch_db:open(Db#db.name, DbOptions1) of
              {ok, Db2} ->
                  keep_sending_changes(
                      Args#changes_args{limit=NewLimit},
                      Callback,
                      UserAcc3,
                      Db2,
                      EndSeq,
                      Prepend2,
                      Timeout,
                      TimeoutFun,
                      false
                  );
              _Else ->
                  end_sending_changes(Callback, UserAcc2, EndSeq, ResponseType)
              end;
          {stop, UserAcc3} ->
              % ?LOG_INFO("wait_db_updated stop ~p",[{Db#db.name, EndSeq}]),
              end_sending_changes(Callback, UserAcc3, EndSeq, ResponseType)
          end
      end.
  
  
negative.code:     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.
  