24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-16 22:05:29 +02:00

fix cached_item issue with PEP

This commit is contained in:
Christophe Romain 2010-05-28 13:17:36 +02:00
parent 01855b4e32
commit e042fdb111
3 changed files with 10 additions and 10 deletions

View File

@ -3679,7 +3679,7 @@ get_max_items_node(Host) ->
%%%% last item cache handling
is_last_item_cache_enabled({_, ServerHost, _}) ->
is_last_item_cache_enabled(ServerHost);
is_last_item_cache_enabled(binary_to_list(ServerHost));
is_last_item_cache_enabled(Host) ->
case catch ets:lookup(gen_mod:get_module_proc(Host, config), last_item_cache) of
[{last_item_cache, true}] -> true;
@ -3687,21 +3687,21 @@ is_last_item_cache_enabled(Host) ->
end.
set_cached_item({_, ServerHost, _}, NodeId, ItemId, Publisher, Payload) ->
set_cached_item(ServerHost, NodeId, ItemId, Publisher, Payload);
set_cached_item(binary_to_list(ServerHost), NodeId, ItemId, Publisher, Payload);
set_cached_item(Host, NodeId, ItemId, Publisher, Payload) ->
case is_last_item_cache_enabled(Host) of
true -> mnesia:dirty_write({pubsub_last_item, NodeId, ItemId, {now(), jlib:short_prepd_bare_jid(Publisher)}, Payload});
_ -> ok
end.
unset_cached_item({_, ServerHost, _}, NodeId) ->
unset_cached_item(ServerHost, NodeId);
unset_cached_item(binary_to_list(ServerHost), NodeId);
unset_cached_item(Host, NodeId) ->
case is_last_item_cache_enabled(Host) of
true -> mnesia:dirty_delete({pubsub_last_item, NodeId});
_ -> ok
end.
get_cached_item({_, ServerHost, _}, NodeId) ->
get_cached_item(ServerHost, NodeId);
get_cached_item(binary_to_list(ServerHost), NodeId);
get_cached_item(Host, NodeId) ->
case is_last_item_cache_enabled(Host) of
true ->

View File

@ -3519,7 +3519,7 @@ get_max_items_node(Host) ->
%%%% last item cache handling
is_last_item_cache_enabled({_, ServerHost, _}) ->
is_last_item_cache_enabled(ServerHost);
is_last_item_cache_enabled(binary_to_list(ServerHost));
is_last_item_cache_enabled(Host) ->
case catch ets:lookup(gen_mod:get_module_proc(Host, config), last_item_cache) of
[{last_item_cache, true}] -> true;
@ -3527,21 +3527,21 @@ is_last_item_cache_enabled(Host) ->
end.
set_cached_item({_, ServerHost, _}, NodeId, ItemId, Publisher, Payload) ->
set_cached_item(ServerHost, NodeId, ItemId, Publisher, Payload);
set_cached_item(binary_to_list(ServerHost), NodeId, ItemId, Publisher, Payload);
set_cached_item(Host, NodeId, ItemId, Publisher, Payload) ->
case is_last_item_cache_enabled(Host) of
true -> mnesia:dirty_write({pubsub_last_item, NodeId, ItemId, {now(), jlib:short_prepd_bare_jid(Publisher)}, Payload});
_ -> ok
end.
unset_cached_item({_, ServerHost, _}, NodeId) ->
unset_cached_item(ServerHost, NodeId);
unset_cached_item(binary_to_list(ServerHost), NodeId);
unset_cached_item(Host, NodeId) ->
case is_last_item_cache_enabled(Host) of
true -> mnesia:dirty_delete({pubsub_last_item, NodeId});
_ -> ok
end.
get_cached_item({_, ServerHost, _}, NodeId) ->
get_cached_item(ServerHost, NodeId);
get_cached_item(binary_to_list(ServerHost), NodeId);
get_cached_item(Host, NodeId) ->
case is_last_item_cache_enabled(Host) of
true ->

View File

@ -1,5 +1,5 @@
--- mod_pubsub.erl 2010-05-28 11:26:21.000000000 +0200
+++ mod_pubsub_odbc.erl 2010-05-28 11:31:43.000000000 +0200
--- mod_pubsub.erl 2010-05-28 13:16:05.000000000 +0200
+++ mod_pubsub_odbc.erl 2010-05-28 13:17:04.000000000 +0200
@@ -42,7 +42,7 @@
%%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
%%% XEP-0060 section 12.18.