diff options
author | Kim Alvefur <zash@zash.se> | 2023-11-26 22:58:11 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2023-11-26 22:58:11 +0100 |
commit | f5f64e3bdc3c355b9e3e0a37e092169bc1842ff3 (patch) | |
tree | 79b8c863c1dc92d2fda73079a010cf99b448c331 | |
parent | ad3ab533edfee569a4b9948db48e0089de5e1162 (diff) | |
download | prosody-f5f64e3bdc3c355b9e3e0a37e092169bc1842ff3.tar.gz prosody-f5f64e3bdc3c355b9e3e0a37e092169bc1842ff3.zip |
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.
-rw-r--r-- | plugins/mod_mam/mod_mam.lua | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua index d8555ec1..b57fc030 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua @@ -249,8 +249,7 @@ module:hook("iq-get/self/"..xmlns_mam..":metadata", function (event) 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 @@ module:hook("iq-get/self/"..xmlns_mam..":metadata", function (event) 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 |