anchor.diff:  
   -define(DOC_ID_TO_REP_ID, rep_doc_id_to_rep_id).
   -define(REP_ID_TO_DOC_ID, rep_id_to_rep_doc_id).
  --define(MAX_RETRIES, 10).
   -define(INITIAL_WAIT, 5).
   
   -record(state, {
       changes_feed_loop = nil,
       db_notifier = nil,
       rep_db_name = nil,
  -    rep_start_pids = []
  +    rep_start_pids = [],
  +    max_retries
   }).
   
   -import(couch_util, [
  
positive.code: 
  stop_replication(DocId) ->
      case ets:lookup(?DOC_ID_TO_REP_ID, DocId) of
      [{DocId, {BaseId, _} = RepId}] ->
          couch_rep:end_replication(RepId),
          true = ets:delete(?REP_ID_TO_DOC_ID, BaseId),
          true = ets:delete(?DOC_ID_TO_REP_ID, DocId),
  
negative.code: 
  handle_cast({rep_db_created, _NewName}, State) ->
      {noreply, restart(State)};
  
  handle_cast({set_max_retries, MaxRetries}, State) ->
      {noreply, State#state{max_retries = MaxRetries}};
  
  handle_cast(Msg, State) ->
      ?LOG_ERROR("Replicator DB listener received unexpected cast ~p", [Msg]),
  