aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-11-26 14:35:26 +0100
committerKim Alvefur <zash@zash.se>2023-11-26 14:35:26 +0100
commitc47cfefec030153645c243542065f3b2c6e793cf (patch)
treead6619c45aa1e46c18f868cb929e6f24d95bb0c5
parent15f487b789c4347fb10d29d22087e6bc9278ec82 (diff)
downloadprosody-c47cfefec030153645c243542065f3b2c6e793cf.tar.gz
prosody-c47cfefec030153645c243542065f3b2c6e793cf.zip
mod_storage_internal: Close lazy-loading list abstraction after trim
Should be done here too.
-rw-r--r--plugins/mod_storage_internal.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/mod_storage_internal.lua b/plugins/mod_storage_internal.lua
index 35d3269f..8c0b4e11 100644
--- a/plugins/mod_storage_internal.lua
+++ b/plugins/mod_storage_internal.lua
@@ -360,6 +360,9 @@ function archive:trim(username, to_when)
-- shortcut: check if the last item should be trimmed, if so, drop the whole archive
local last = list[#list].when or datetime.parse(list[#list].attr.stamp);
if last <= to_when then
+ if list.close then
+ list:close()
+ end
return datamanager.list_store(username, host, self.store, nil);
end
@@ -368,6 +371,9 @@ function archive:trim(username, to_when)
local when = item.when or datetime.parse(item.attr.stamp);
return to_when - when;
end);
+ if list.close then
+ list:close()
+ end
-- TODO if exact then ... off by one?
if i == 1 then return 0; end
local ok, err = datamanager.list_shift(username, host, self.store, i);