Skip to content

Commit

Permalink
Merge pull request 2600hz#467 from 2600hz/KAZOO-2257
Browse files Browse the repository at this point in the history
KAZOO-2257:  flush stepswitch cache on crossbar resources change
  • Loading branch information
James Aimonetti committed Aug 20, 2014
2 parents e623a7a + 561f330 commit 077d85b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions applications/stepswitch/src/stepswitch_resources.erl
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ fetch_global_resources() ->
-type wh_cache_props() :: [cache_property(),...] | [].

-spec fetch_global_cache_origin(wh_json:objects(), wh_cache_props()) -> wh_cache_props().
fetch_global_cache_origin([], Props) -> Props;
fetch_global_cache_origin([], Props) -> [{'type', <<"resource">>} | Props];
fetch_global_cache_origin([JObj|JObjs], Props) ->
Id = wh_json:get_value(<<"id">>, JObj),
fetch_global_cache_origin(JObjs, [{'db', ?RESOURCES_DB, Id}|Props]).
Expand Down Expand Up @@ -516,7 +516,7 @@ fetch_local_resources(AccountId) ->
end.

-spec fetch_local_cache_origin(wh_json:objects(), ne_binary(), wh_cache_props()) -> wh_cache_props().
fetch_local_cache_origin([], _, Props) -> Props;
fetch_local_cache_origin([], _, Props) -> [{'type', <<"resource">>} | Props];
fetch_local_cache_origin([JObj|JObjs], AccountDb, Props) ->
Id = wh_json:get_value(<<"id">>, JObj),
fetch_local_cache_origin(JObjs, AccountDb, [{'db', AccountDb, Id}|Props]).
Expand Down
2 changes: 1 addition & 1 deletion applications/stepswitch/src/stepswitch_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ lookup_number(Number) ->
fetch_number(Num) ->
case wh_number_manager:lookup_account_by_number(Num) of
{'ok', AccountId, Props} ->
CacheProps = [{'origin', {'db', wnm_util:number_to_db_name(Num), Num}}],
CacheProps = [{'origin', [{'db', wnm_util:number_to_db_name(Num), Num}, {'type', <<"number">>}]}],
wh_cache:store_local(?STEPSWITCH_CACHE, cache_key_number(Num), {AccountId, Props}, CacheProps),
lager:debug("~s is associated with account ~s", [Num, AccountId]),
{'ok', AccountId, Props};
Expand Down

0 comments on commit 077d85b

Please sign in to comment.