anchor.diff:          Change ->
               Line = [?JSON_ENCODE(Change) | "\n"],
               {ok, Resp1} = chttpd:send_delayed_chunk(Resp, Line),
  -            {ok, Acc#acc{resp=Resp1, last_data_sent_time=os:timestamp()}}
  +            Acc1 = Acc#acc{
  +                resp=Resp1,
  +                last_data_sent_time=os:timestamp()
  +            },
  +            maybe_finish(Acc1)
       end;
   changes_callback({stop, EndSeq}, #acc{feed="continuous"}=Acc) ->
       % Temporary upgrade clause - Case 24236
  
positive.code:         {heartbeat, Other} -> Other;
          false -> false
      end,
      chttpd:verify_is_server_admin(Req),
      Acc = #acc{
          username=admin,
          feed=Feed,
          resp=Req,
          heartbeat_interval=Heartbeat
      },
      case Feed of
          "normal" ->
              {ok, Info} = fabric:get_db_info(Db),
              Etag = chttpd:make_etag(Info),
              chttpd:etag_respond(Req, Etag, fun() ->
                  fabric:changes(Db, fun changes_callback/2, Acc#acc{etag=Etag}, Options)
              end);
          Feed when Feed =:= "continuous"; Feed =:= "longpoll" ->
              fabric:changes(Db, fun changes_callback/2, Acc, Options);
          _ ->
              Msg = <<"Supported `feed` types: normal, continuous, longpoll">>,
              throw({bad_request, Msg})
  
negative.code:             chttpd:send_error(Resp, Reason);
          _ ->
              chttpd:send_delayed_error(Resp, Reason)
      end.
  
  
  maybe_finish(Acc) ->
      case Acc#acc.limit of
          0 ->
              {stop, Acc};
          undefined ->
              {ok, Acc};
          Limit ->
              {ok, Acc#acc{limit=Limit-1}}
      end.
  
  
  