# HG changeset patch # User Kim Alvefur # Date 1606745849 -3600 # Node ID 281a864e74729d56b010c51c00582d5fa79ea50c # Parent 3c80e46e26f2653737d7581f5c62e212231e33eb mod_pubsub_feeds: Don't skip publishing items after an existing one I encountered a feed which was backwards, such that older entries were considered first and then it would skip newer entries. This may however run into trouble if the feed contains more items than what's persisted in pubsub. diff -r 3c80e46e26f2 -r 281a864e7472 mod_pubsub_feeds/mod_pubsub_feeds.lua --- a/mod_pubsub_feeds/mod_pubsub_feeds.lua Tue Dec 01 22:12:16 2020 +0100 +++ b/mod_pubsub_feeds/mod_pubsub_feeds.lua Mon Nov 30 15:17:29 2020 +0100 @@ -118,18 +118,15 @@ -- Sigh, no link? id = feed.url .. "#" .. hmac_sha1(feed.url, tostring(entry), true) .. "@" .. dt_datetime(timestamp); end - if items[id] then - -- Assume that this existing means we've added all new items - -- FIXME Entries updated after publishing ... - break; - end - local xitem = st.stanza("item", { id = id, xmlns = "http://jabber.org/protocol/pubsub" }):add_child(entry); - -- TODO Put data from /feed into item/source + if not items[id] then + local xitem = st.stanza("item", { id = id, xmlns = "http://jabber.org/protocol/pubsub" }):add_child(entry); + -- TODO Put data from /feed into item/source - --module:log("debug", "publishing to %s, id %s", node, id); - local ok, err = pubsub.service:publish(node, true, id, xitem); - if not ok then - module:log("error", "Publishing to node %s failed: %s", node, err); + --module:log("debug", "publishing to %s, id %s", node, id); + local ok, err = pubsub.service:publish(node, true, id, xitem); + if not ok then + module:log("error", "Publishing to node %s failed: %s", node, err); + end end end end