mirror of
https://github.com/processone/ejabberd.git
synced 2025-01-03 18:02:28 +01:00
Handle ets_cache return value in shared roster get_group_opts (#3296)
This commit is contained in:
parent
266691f929
commit
7efc208b9e
@ -448,7 +448,7 @@ delete_group(Host, Group) ->
|
||||
get_group_opts(Host1, Group1) ->
|
||||
{Host, Group} = split_grouphost(Host1, Group1),
|
||||
Mod = gen_mod:db_mod(Host, ?MODULE),
|
||||
case use_cache(Mod, Host) of
|
||||
Res = case use_cache(Mod, Host) of
|
||||
true ->
|
||||
ets_cache:lookup(
|
||||
?GROUP_OPTS_CACHE, {Host, Group},
|
||||
@ -460,6 +460,10 @@ get_group_opts(Host1, Group1) ->
|
||||
end);
|
||||
false ->
|
||||
Mod:get_group_opts(Host, Group)
|
||||
end,
|
||||
case Res of
|
||||
{ok, Opts} -> Opts;
|
||||
error -> error
|
||||
end.
|
||||
|
||||
set_group_opts(Host, Group, Opts) ->
|
||||
|
@ -87,7 +87,7 @@ delete_group(Host, Group) ->
|
||||
|
||||
get_group_opts(Host, Group) ->
|
||||
case catch mnesia:dirty_read(sr_group, {Group, Host}) of
|
||||
[#sr_group{opts = Opts}] -> Opts;
|
||||
[#sr_group{opts = Opts}] -> {ok, Opts};
|
||||
_ -> error
|
||||
end.
|
||||
|
||||
|
@ -94,7 +94,7 @@ get_group_opts(Host, Group) ->
|
||||
?SQL("select @(opts)s from sr_group"
|
||||
" where name=%(Group)s and %(Host)H")) of
|
||||
{selected, [{SOpts}]} ->
|
||||
mod_shared_roster:opts_to_binary(ejabberd_sql:decode_term(SOpts));
|
||||
{ok, mod_shared_roster:opts_to_binary(ejabberd_sql:decode_term(SOpts))};
|
||||
_ -> error
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user