anchor.diff:      Args = make_changes_args(Options),
       {ok, Acc} = Callback(start, Acc0),
       Notifiers = start_update_notifiers(DbName),
  -    {Timeout, TimeoutFun} = couch_changes:get_changes_timeout(Args, Callback),
  +    {Timeout, _} = couch_changes:get_changes_timeout(Args, Callback),
       try
           keep_sending_changes(
               DbName,
  
positive.code:             Callback,
              get_start_seq(DbName, Args),
              Acc,
              Timeout,
              TimeoutFun
          )
      after
          stop_update_notifiers(Notifiers),
  
negative.code:     ),
      Callback({stop, pack_seqs(Seqs)}, AccOut).
  
  keep_sending_changes(DbName, Args, Callback, Seqs, AccIn, Timeout) ->
      #changes_args{limit=Limit, feed=Feed, heartbeat=Heartbeat} = Args,
      {ok, Collector} = send_changes(DbName, Args, Callback, Seqs, AccIn),
      #collector{limit=Limit2, counters=NewSeqs, user_acc=AccOut} = Collector,
      LastSeq = pack_seqs(NewSeqs),
      if Limit > Limit2, Feed == "longpoll" ->
          Callback({stop, LastSeq}, AccOut);
      true ->
          case wait_db_updated(Timeout) of
          updated ->
              keep_sending_changes(
                  DbName,
                  Args#changes_args{limit=Limit2},
                  Callback,
                  LastSeq,
                  AccOut,
                  Timeout
              );
          timeout ->
              case Heartbeat of undefined ->
                  Callback({stop, LastSeq}, AccOut);
              _ ->
                  {ok, AccTimeout} = Callback(timeout, AccOut),
                  keep_sending_changes(DbName, Args#changes_args{limit=Limit2},
                      Callback, LastSeq, AccTimeout, Timeout)
              end
          end
      end.
  
  