diff options
author | Christophe Romain <christophe.romain@process-one.net> | 2017-08-02 12:22:13 +0200 |
---|---|---|
committer | Christophe Romain <christophe.romain@process-one.net> | 2017-08-02 12:24:34 +0200 |
commit | 73509686f18bf0689abeb9bff024d08ff3d1d969 (patch) | |
tree | 6fa292c7558c70d001364a08deead0fbea5552a4 | |
parent | Fix spec for mod_pubsub:subscribe_node (diff) |
Fix getting cached last item (#1814)
-rw-r--r-- | src/mod_pubsub.erl | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index 4a2e20f87..263b33ab9 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -2142,9 +2142,14 @@ get_allowed_items_call(Host, Nidx, From, Type, Options, Owners, RSM) -> node_call(Host, Type, get_items, [Nidx, From, AccessModel, PS, RG, undefined, RSM]). get_last_items(Host, Type, Nidx, LJID, Count) -> - case node_action(Host, Type, get_last_items, [Nidx, LJID, Count]) of - {result, Items} -> Items; - _ -> [] + case get_cached_item(Host, Nidx) of + undefined -> + case node_action(Host, Type, get_last_items, [Nidx, LJID, Count]) of + {result, Items} -> Items; + _ -> [] + end; + LastItem -> + [LastItem] end. %% @doc <p>Resend the items of a node to the user.</p> |