diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-02-22 19:47:00 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-02-22 19:47:00 +0300 |
commit | 96a690f6072a7c03eac130b8bbb4215be0a4e8b7 (patch) | |
tree | afff348a49a6a7deed104a0a4072c5a3be205274 | |
parent | Reload modules when reloading configuration file (diff) | |
parent | Fix match of itemid on get_cached_item, fixes 14e771d8 (diff) |
Merge branch 'master' of github.com:processone/ejabberd
-rw-r--r-- | src/mod_pubsub.erl | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index 2013ed9cf..e512afa09 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -3423,10 +3423,15 @@ set_cached_item({_, ServerHost, _}, Nidx, ItemId, Publisher, Payload) -> set_cached_item(ServerHost, Nidx, ItemId, Publisher, Payload); set_cached_item(Host, Nidx, ItemId, Publisher, Payload) -> case is_last_item_cache_enabled(Host) of - true -> mnesia:dirty_write({pubsub_last_item, {Host, Nidx}, ItemId, - {p1_time_compat:timestamp(), jid:tolower(jid:remove_resource(Publisher))}, - Payload}); - _ -> ok + true -> + Stamp = {p1_time_compat:timestamp(), jid:tolower(jid:remove_resource(Publisher))}, + Item = #pubsub_last_item{nodeid = {Host, Nidx}, + itemid = ItemId, + creation = Stamp, + payload = Payload}, + mnesia:dirty_write(Item); + _ -> + ok end. -spec unset_cached_item(host(), nodeIdx()) -> ok. @@ -3445,9 +3450,7 @@ get_cached_item(Host, Nidx) -> case is_last_item_cache_enabled(Host) of true -> case mnesia:dirty_read({pubsub_last_item, {Host, Nidx}}) of - [#pubsub_last_item{itemid = {Host, ItemId}, creation = Creation, payload = Payload}] -> - % [{pubsub_last_item, Nidx, ItemId, Creation, - % Payload}] -> + [#pubsub_last_item{itemid = ItemId, creation = Creation, payload = Payload}] -> #pubsub_item{itemid = {ItemId, Nidx}, payload = Payload, creation = Creation, modification = Creation}; |