Skip to content

Commit

Permalink
* update rebar config for new pb tag
Browse files Browse the repository at this point in the history
* better naming of timeout/nval fns
  • Loading branch information
zeeshanlakhani committed Mar 18, 2015
1 parent 9284f7c commit fd20f92
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{eunit_opts, [verbose]}.
{erl_opts, [warnings_as_errors, debug_info, nowarn_deprecated_type]}.
{deps, [
{riak_pb, "2.1.0.0", {git, "git://github.com/basho/riak_pb", {tag, "2.1.0.0"}}}
{riak_pb, "2.1.0.1", {git, "git://github.com/basho/riak_pb", {tag, "2.1.0.1"}}}
]}.
{edoc_opts, [{stylesheet_file, "priv/edoc.css"},
{preprocess, true}]}.
Expand Down
24 changes: 12 additions & 12 deletions src/riakc_pb_socket.erl
Original file line number Diff line number Diff line change
Expand Up @@ -896,15 +896,15 @@ create_search_index(Pid, Index, SchemaName, Timeout)
create_search_index(Pid, Index, SchemaName, Opts) ->
Timeout = proplists:get_value(timeout, Opts, default_timeout(search_timeout)),
NVal = proplists:get_value(n_val, Opts),
Req = set_search_req_nval(NVal, Index, SchemaName),
Req1 = set_search_req_timeout(Timeout, Req),
Req = set_index_create_req_nval(NVal, Index, SchemaName),
Req1 = set_index_create_req_timeout(Timeout, Req),

Timeout1 = if
is_integer(Timeout) ->
%% Add an extra 500ms to the create_search_index timeout
%% and use that for the socket timeout.
%% This should give the creation to throw back a proper
%% response.
%% This should give the creation process time to throw
%% back a proper response.
Timeout + 500;
true ->
Timeout
Expand Down Expand Up @@ -2307,30 +2307,30 @@ maybe_make_bucket_type(Type, Bucket) ->

%% @private
%% @doc Create/Set record based on NVal value or throw an error.
-spec set_search_req_nval(pos_integer()|undefined, binary(), binary()) ->
-spec set_index_create_req_nval(pos_integer()|undefined, binary(), binary()) ->
#rpbyokozunaindexputreq{}.
set_search_req_nval(NVal, Index, SchemaName) when is_integer(NVal) ->
set_index_create_req_nval(NVal, Index, SchemaName) when is_integer(NVal) ->
#rpbyokozunaindexputreq{index = #rpbyokozunaindex{
name = Index,
schema = SchemaName,
n_val = NVal}};
set_search_req_nval(NVal, Index, SchemaName) when NVal =:= undefined ->
set_index_create_req_nval(NVal, Index, SchemaName) when NVal =:= undefined ->
#rpbyokozunaindexputreq{index = #rpbyokozunaindex{
name = Index,
schema = SchemaName}};
set_search_req_nval(NVal, _Index, _SchemaName)
set_index_create_req_nval(NVal, _Index, _SchemaName)
when not is_integer(NVal); NVal =/= undefined ->
erlang:error(badarg).

%% @private
%% @doc Set record based on Timeout value or throw an error.
-spec set_search_req_timeout(timeout(), #rpbyokozunaindexputreq{}) ->
-spec set_index_create_req_timeout(timeout(), #rpbyokozunaindexputreq{}) ->
#rpbyokozunaindexputreq{}.
set_search_req_timeout(Timeout, Req) when is_integer(Timeout) ->
set_index_create_req_timeout(Timeout, Req) when is_integer(Timeout) ->
Req#rpbyokozunaindexputreq{timeout = Timeout};
set_search_req_timeout(Timeout, Req) when Timeout =:= infinity ->
set_index_create_req_timeout(Timeout, Req) when Timeout =:= infinity ->
Req;
set_search_req_timeout(Timeout, _Req) when not is_integer(Timeout) ->
set_index_create_req_timeout(Timeout, _Req) when not is_integer(Timeout) ->
erlang:error(badarg).


Expand Down

0 comments on commit fd20f92

Please sign in to comment.