mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-02 21:17:12 +02:00
do not store item when persist_item false but send_last_published_item and last_item_cache enabled
SVN Revision: 2411
This commit is contained in:
parent
b08c061683
commit
31d6fe3c7d
|
@ -3173,8 +3173,13 @@ max_items(Options) ->
|
||||||
end;
|
end;
|
||||||
false ->
|
false ->
|
||||||
case get_option(Options, send_last_published_item) of
|
case get_option(Options, send_last_published_item) of
|
||||||
never -> 0;
|
never ->
|
||||||
_ -> 1
|
0;
|
||||||
|
_ ->
|
||||||
|
case is_last_item_cache_enabled(Host) of
|
||||||
|
true -> 0;
|
||||||
|
false -> 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -3389,29 +3394,31 @@ set_xoption([_ | Opts], NewOpts) ->
|
||||||
|
|
||||||
%%%% last item cache handling
|
%%%% last item cache handling
|
||||||
|
|
||||||
|
is_last_item_cache_enabled(Host) ->
|
||||||
|
case ets:lookup(gen_mod:get_module_proc(Host, config), last_item_cache) of
|
||||||
|
[{last_item_cache, true}] -> true;
|
||||||
|
_ false
|
||||||
|
end.
|
||||||
|
|
||||||
set_cached_item({_, ServerHost, _}, NodeId, ItemId, Payload) ->
|
set_cached_item({_, ServerHost, _}, NodeId, ItemId, Payload) ->
|
||||||
set_cached_item(ServerHost, NodeId, ItemId, Payload);
|
set_cached_item(ServerHost, NodeId, ItemId, Payload);
|
||||||
set_cached_item(Host, NodeId, ItemId, Payload) ->
|
set_cached_item(Host, NodeId, ItemId, Payload) ->
|
||||||
case ets:lookup(gen_mod:get_module_proc(Host, config), last_item_cache) of
|
case is_last_item_cache_enabled(Host) of
|
||||||
[{last_item_cache, true}] ->
|
true -> ets:insert(gen_mod:get_module_proc(Host, last_items), {NodeId, {ItemId, Payload}});
|
||||||
ets:insert(gen_mod:get_module_proc(Host, last_items), {NodeId, {ItemId, Payload}});
|
_ -> ok
|
||||||
_ ->
|
|
||||||
ok
|
|
||||||
end.
|
end.
|
||||||
unset_cached_item({_, ServerHost, _}, NodeId) ->
|
unset_cached_item({_, ServerHost, _}, NodeId) ->
|
||||||
unset_cached_item(ServerHost, NodeId);
|
unset_cached_item(ServerHost, NodeId);
|
||||||
unset_cached_item(Host, NodeId) ->
|
unset_cached_item(Host, NodeId) ->
|
||||||
case ets:lookup(gen_mod:get_module_proc(Host, config), last_item_cache) of
|
case is_last_item_cache_enabled(Host) of
|
||||||
[{last_item_cache, true}] ->
|
true -> ets:delete(gen_mod:get_module_proc(Host, last_items), NodeId);
|
||||||
ets:delete(gen_mod:get_module_proc(Host, last_items), NodeId);
|
_ -> ok
|
||||||
_ ->
|
|
||||||
ok
|
|
||||||
end.
|
end.
|
||||||
get_cached_item({_, ServerHost, _}, NodeId) ->
|
get_cached_item({_, ServerHost, _}, NodeId) ->
|
||||||
get_cached_item(ServerHost, NodeId);
|
get_cached_item(ServerHost, NodeId);
|
||||||
get_cached_item(Host, NodeId) ->
|
get_cached_item(Host, NodeId) ->
|
||||||
case ets:lookup(gen_mod:get_module_proc(Host, config), last_item_cache) of
|
case is_last_item_cache_enabled(Host) of
|
||||||
[{last_item_cache, true}] ->
|
true ->
|
||||||
case ets:lookup(gen_mod:get_module_proc(Host, last_items), NodeId) of
|
case ets:lookup(gen_mod:get_module_proc(Host, last_items), NodeId) of
|
||||||
[{NodeId, {ItemId, Payload}}] ->
|
[{NodeId, {ItemId, Payload}}] ->
|
||||||
#pubsub_item{itemid = {ItemId, NodeId}, payload = Payload};
|
#pubsub_item{itemid = {ItemId, NodeId}, payload = Payload};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user