mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-28 17:38:54 +01:00
Fix match of itemid on get_cached_item, fixes 14e771d8
This commit is contained in:
parent
56df6e7ba8
commit
87b5e2500b
@ -3423,10 +3423,15 @@ 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, {Host, Nidx}, ItemId,
|
true ->
|
||||||
{p1_time_compat:timestamp(), jid:tolower(jid:remove_resource(Publisher))},
|
Stamp = {p1_time_compat:timestamp(), jid:tolower(jid:remove_resource(Publisher))},
|
||||||
Payload});
|
Item = #pubsub_last_item{nodeid = {Host, Nidx},
|
||||||
_ -> ok
|
itemid = ItemId,
|
||||||
|
creation = Stamp,
|
||||||
|
payload = Payload},
|
||||||
|
mnesia:dirty_write(Item);
|
||||||
|
_ ->
|
||||||
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec unset_cached_item(host(), nodeIdx()) -> ok.
|
-spec unset_cached_item(host(), nodeIdx()) -> ok.
|
||||||
@ -3445,9 +3450,7 @@ 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, {Host, Nidx}}) of
|
case mnesia:dirty_read({pubsub_last_item, {Host, Nidx}}) of
|
||||||
[#pubsub_last_item{itemid = {Host, ItemId}, creation = Creation, payload = Payload}] ->
|
[#pubsub_last_item{itemid = ItemId, creation = Creation, payload = Payload}] ->
|
||||||
% [{pubsub_last_item, Nidx, ItemId, Creation,
|
|
||||||
% Payload}] ->
|
|
||||||
#pubsub_item{itemid = {ItemId, Nidx},
|
#pubsub_item{itemid = {ItemId, Nidx},
|
||||||
payload = Payload, creation = Creation,
|
payload = Payload, creation = Creation,
|
||||||
modification = Creation};
|
modification = Creation};
|
||||||
|
Loading…
Reference in New Issue
Block a user