Diff

plugins/mod_mam/mod_mam.lua @ 13357:f424c9f1460b

mod_mam: Use for loop in metadata query Some storage drivers will perform cleanup after the last iteration, but if only one step is taken this might be delayed until the garbage collector gets to it.
author Kim Alvefur <zash@zash.se>
date Sun, 26 Nov 2023 22:58:11 +0100
parent 13230:26c30844cac6
line wrap: on
line diff
--- a/plugins/mod_mam/mod_mam.lua	Wed Nov 29 17:51:34 2023 +0000
+++ b/plugins/mod_mam/mod_mam.lua	Sun Nov 26 22:58:11 2023 +0100
@@ -249,8 +249,7 @@
 			return true;
 		end
 
-		local id, _, when = first();
-		if id then
+		for id, _, when in first do
 			reply:tag("start", { id = id, timestamp = timestamp(when) }):up();
 		end
 	end
@@ -262,8 +261,7 @@
 			return true;
 		end
 
-		local id, _, when = last();
-		if id then
+		for id, _, when in last do
 			reply:tag("end", { id = id, timestamp = timestamp(when) }):up();
 		end
 	end