changeset 5577:e7792188540a

mod_pubsub_feeds: Retrieve only the most recent item to compare Only need one item id. Fetching all items probably caused memory usage peaks.
author Kim Alvefur <zash@zash.se>
date Sun, 25 Jun 2023 19:58:45 +0200
parents c729a38f21b1
children b9821e9a21a2
files mod_pubsub_feeds/mod_pubsub_feeds.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pubsub_feeds/mod_pubsub_feeds.lua	Sun Jun 25 19:52:24 2023 +0200
+++ b/mod_pubsub_feeds/mod_pubsub_feeds.lua	Sun Jun 25 19:58:45 2023 +0200
@@ -81,9 +81,9 @@
 	for entry in feed:childtags("entry") do
 		table.insert(entries, entry);
 	end
-	local ok, items = pubsub.service:get_items(node, true);
+	local ok, last_id = pubsub.service:get_last_item(node, true);
 	if not ok then
-		module:log("error", "PubSub node %q missing: %s", node, items);
+		module:log("error", "PubSub node %q missing: %s", node, last_id);
 		return
 	end
 
@@ -102,7 +102,7 @@
 			entry:text_tag("id", id);
 		end
 
-		if items[id] then
+		if last_id == id then
 			-- This should be the first item that we already have.
 			start_from = i-1;
 			break