mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-28 17:38:54 +01:00
Merge branch 'master' of github.com:processone/ejabberd
This commit is contained in:
commit
96a690f607
@ -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