Permalink
Browse files

WHISTLE-42: dont alert for fs_notify lookups, and dont create the hot…

…ornot queue as exclusive
  • Loading branch information...
1 parent f04dd84 commit 06b789670358c63b99bd5485bc7da9687b20ec65 @k-anderson k-anderson committed May 29, 2012
@@ -289,7 +289,7 @@ code_change(_OldVsn, State, _Extra) ->
%%--------------------------------------------------------------------
-spec get_endpoint/2 :: (ne_binary(), ne_binary()) -> {'error', 'timeout'} | nonempty_string().
get_endpoint(Username, Realm) ->
- case ecallmgr_registrar:lookup_contact(Realm, Username) of
+ case ecallmgr_registrar:lookup_contact(Realm, Username, false) of
{ok, Contact} ->
RURI = binary:replace(re:replace(Contact, "^[^\@]+", Username, [{return, binary}]), <<">">>, <<"">>),
wh_util:to_list(<<"sip:", (RURI)/binary>>);
@@ -8,7 +8,7 @@
-module(ecallmgr_registrar).
-export([reg_success/2]).
--export([lookup_contact/2]).
+-export([lookup_contact/2, lookup_contact/3]).
-export([endpoint_node/2]).
-export([lookup/3]).
@@ -31,16 +31,25 @@ reg_success(Props, Node) ->
wh_cache:store_local(?ECALLMGR_REG_CACHE, ?NODE_KEY(Realm, Username), Node, ecallmgr_util:get_expires(Props)).
-spec lookup_contact/2 :: (ne_binary(), ne_binary()) -> {'ok', ne_binary()} | {'error', 'timeout'}.
+-spec lookup_contact/3 :: (ne_binary(), ne_binary(), boolean()) -> {'ok', ne_binary()} | {'error', 'timeout'}.
+
lookup_contact(Realm, Username) ->
+ lookup_contact(Realm, Username, true).
+
+lookup_contact(Realm, Username, Notify) ->
case wh_cache:fetch_local(?ECALLMGR_REG_CACHE, ?CONTACT_KEY(Realm, Username)) of
{ok, Contact} -> {ok, Contact};
{error, not_found} ->
case lookup(Realm, Username, [<<"Contact">>]) of
[{<<"Contact">>, Contact}] -> {ok, Contact};
- {error, Reason}=E ->
+ {error, Reason}=E when Notify ->
+ lager:debug("failed to find registration for ~s@~s: ~p", [Username, Realm, Reason]),
wh_notify:system_alert("Failed to find registration for ~s@~s"
,[Username, Realm]
,[{<<"Reason">>, wh_util:to_binary(Reason)}]),
+ E;
+ {error, _R}=E ->
+ lager:debug("failed to find registration for ~s@~s: ~p", [Username, Realm, _R]),
E
end
end.
@@ -29,8 +29,8 @@
-define(BINDINGS, [ {rate, []} ]).
-define(RESPONDERS, [{hon_rater, [{<<"rate">>, <<"req">>}]}]).
-define(QUEUE_NAME, <<"hotornot_rating">>).
--define(QUEUE_OPTIONS, []).
--define(CONSUME_OPTIONS, []).
+-define(QUEUE_OPTIONS, [{exclusive, false}]).
+-define(CONSUME_OPTIONS, [{exclusive, false}]).
%%%===================================================================
%%% API

0 comments on commit 06b7896

Please sign in to comment.