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.
--- 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