mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
mod_pubsub: Fix last item cache for multiple hosts
Don't let the last item cache intermix PubSub items of different virtual domains.
This commit is contained in:
parent
56ef607904
commit
14e771d871
@ -166,7 +166,7 @@
|
|||||||
|
|
||||||
-record(pubsub_last_item,
|
-record(pubsub_last_item,
|
||||||
{
|
{
|
||||||
nodeid ,% :: mod_pubsub:nodeIdx(),
|
nodeid ,% :: {binary(), mod_pubsub:nodeIdx()},
|
||||||
itemid ,% :: mod_pubsub:itemId(),
|
itemid ,% :: mod_pubsub:itemId(),
|
||||||
creation ,% :: {erlang:timestamp(), jlib:ljid()},
|
creation ,% :: {erlang:timestamp(), jlib:ljid()},
|
||||||
payload % :: mod_pubsub:payload()
|
payload % :: mod_pubsub:payload()
|
||||||
|
@ -177,7 +177,7 @@
|
|||||||
|
|
||||||
-type(pubsubLastItem() ::
|
-type(pubsubLastItem() ::
|
||||||
#pubsub_last_item{
|
#pubsub_last_item{
|
||||||
nodeid :: mod_pubsub:nodeIdx(),
|
nodeid :: {binary(), mod_pubsub:nodeIdx()},
|
||||||
itemid :: mod_pubsub:itemId(),
|
itemid :: mod_pubsub:itemId(),
|
||||||
creation :: {erlang:timestamp(), ljid()},
|
creation :: {erlang:timestamp(), ljid()},
|
||||||
payload :: mod_pubsub:payload()
|
payload :: mod_pubsub:payload()
|
||||||
@ -3426,7 +3426,7 @@ set_cached_item({_, ServerHost, _}, Nidx, ItemId, Publisher, Payload) ->
|
|||||||
set_cached_item(ServerHost, Nidx, ItemId, Publisher, Payload);
|
set_cached_item(ServerHost, Nidx, ItemId, Publisher, Payload);
|
||||||
set_cached_item(Host, Nidx, ItemId, Publisher, Payload) ->
|
set_cached_item(Host, Nidx, ItemId, Publisher, Payload) ->
|
||||||
case is_last_item_cache_enabled(Host) of
|
case is_last_item_cache_enabled(Host) of
|
||||||
true -> mnesia:dirty_write({pubsub_last_item, Nidx, ItemId,
|
true -> mnesia:dirty_write({pubsub_last_item, {Host, Nidx}, ItemId,
|
||||||
{p1_time_compat:timestamp(), jid:tolower(jid:remove_resource(Publisher))},
|
{p1_time_compat:timestamp(), jid:tolower(jid:remove_resource(Publisher))},
|
||||||
Payload});
|
Payload});
|
||||||
_ -> ok
|
_ -> ok
|
||||||
@ -3437,7 +3437,7 @@ unset_cached_item({_, ServerHost, _}, Nidx) ->
|
|||||||
unset_cached_item(ServerHost, Nidx);
|
unset_cached_item(ServerHost, Nidx);
|
||||||
unset_cached_item(Host, Nidx) ->
|
unset_cached_item(Host, Nidx) ->
|
||||||
case is_last_item_cache_enabled(Host) of
|
case is_last_item_cache_enabled(Host) of
|
||||||
true -> mnesia:dirty_delete({pubsub_last_item, Nidx});
|
true -> mnesia:dirty_delete({pubsub_last_item, {Host, Nidx}});
|
||||||
_ -> ok
|
_ -> ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -3447,8 +3447,8 @@ get_cached_item({_, ServerHost, _}, Nidx) ->
|
|||||||
get_cached_item(Host, Nidx) ->
|
get_cached_item(Host, Nidx) ->
|
||||||
case is_last_item_cache_enabled(Host) of
|
case is_last_item_cache_enabled(Host) of
|
||||||
true ->
|
true ->
|
||||||
case mnesia:dirty_read({pubsub_last_item, Nidx}) of
|
case mnesia:dirty_read({pubsub_last_item, {Host, Nidx}}) of
|
||||||
[#pubsub_last_item{itemid = ItemId, creation = Creation, payload = Payload}] ->
|
[#pubsub_last_item{itemid = {Host, ItemId}, creation = Creation, payload = Payload}] ->
|
||||||
% [{pubsub_last_item, Nidx, ItemId, Creation,
|
% [{pubsub_last_item, Nidx, ItemId, Creation,
|
||||||
% Payload}] ->
|
% Payload}] ->
|
||||||
#pubsub_item{itemid = {ItemId, Nidx},
|
#pubsub_item{itemid = {ItemId, Nidx},
|
||||||
|
Loading…
Reference in New Issue
Block a user