anchor.diff:  %%--------------------------------------------------------------------
   -spec gateway_loop(State :: #{atom() => term()}) -> no_return().
   gateway_loop(#{port_fd := PortFD, id := {_, N} = ID, db_hostname := Hostname, db_port := Port, gw_port := GWPort,
  -    start_time := ST, parent := Parent, last_ping_time := LPT, bucket := Bucket} = State) ->
  +    start_time := ST, parent := Parent, last_ping_time := LPT, bucket := Bucket, doc_batch_ts := DocBatchTS} = State) ->
   
       %% Update state
       Gateways = datastore_worker:state_get(db_gateways),
  
positive.code: save_doc(ModelConfig, #document{rev = undefined} = Doc) ->
      create(ModelConfig, Doc);
  save_doc(#model_config{bucket = Bucket} = ModelConfig, ToSave = #document{key = Key, rev = Rev, value = Value}) ->
      ok = assert_value_size(Value, ModelConfig, Key),
  
      {Props} = to_json_term(Value),
      Doc = {[{<<"_rev">>, Rev}, {<<"_id">>, to_driver_key(Bucket, Key)} | Props]},
      case db_run(select_bucket(ModelConfig, ToSave), couchbeam, save_doc, [Doc, ?DEFAULT_DB_REQUEST_TIMEOUT_OPT], 3) of
          {ok, {SaveReport}} ->
              case verify_ans(SaveReport) of
                  true ->
                      {ok, Key};
                  _ ->
                      {error, db_internal_error}
              end;
          {error, conflict} ->
              {error, already_exists};
          {error, Reason} ->
              {error, Reason}
      end.
  
  %%--------------------------------------------------------------------
  %% @doc
  
negative.code:     end,
  
  
      UpdatedState0 = case erlang:system_time(milli_seconds) - LPT > timer:seconds(1) of
          true ->
              try
                  true = port_command(PortFD, <<"ping">>, [nosuspend]),
  