Software /
code /
prosody-modules
Changeset
2379:bc6e63ab2a7c
mod_pubsub_feeds: Iterate over feed backwards due to most feeds being in reverse chronological order
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 19 Nov 2016 19:07:00 +0100 |
parents | 2378:649f733aa3dc |
children | 2380:2f083426fe98 |
files | mod_pubsub_feeds/mod_pubsub_feeds.lua |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_pubsub_feeds/mod_pubsub_feeds.lua Sat Nov 19 18:48:49 2016 +0100 +++ b/mod_pubsub_feeds/mod_pubsub_feeds.lua Sat Nov 19 19:07:00 2016 +0100 @@ -79,7 +79,12 @@ local node = item.node; module:log("debug", "parsing %d bytes of data in node %s", #item.data or 0, node) local feed = parse_feed(item.data); + local entries = {}; for entry in feed:childtags("entry") do + table.insert(entries, entry); + end + for i = #entries, 1, -1 do -- Feeds are usually in reverse order + local entry = feed[i]; entry.attr.xmlns = xmlns_atom; local e_published = entry:get_child_text("published");