aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-11-26 18:02:13 +0100
committerKim Alvefur <zash@zash.se>2023-11-26 18:02:13 +0100
commit97332bf56f6484c233472bb2da51deded00b737b (patch)
tree817640484422bcca54aa81fd7fbccdab4b0b8551
parentc9aa3894ecb6e01dd4508121d7872cae9d01a2ab (diff)
downloadprosody-97332bf56f6484c233472bb2da51deded00b737b.tar.gz
prosody-97332bf56f6484c233472bb2da51deded00b737b.zip
mod_storage_internal: Clear archive item count cache after experimental trim
The previous count would be invalid at this point. Should be possible to math out how many items are left, but this is left as future work.
-rw-r--r--plugins/mod_storage_internal.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/mod_storage_internal.lua b/plugins/mod_storage_internal.lua
index 8c0b4e11..1f1ad68f 100644
--- a/plugins/mod_storage_internal.lua
+++ b/plugins/mod_storage_internal.lua
@@ -348,6 +348,7 @@ function archive:users()
end
function archive:trim(username, to_when)
+ local cache_key = jid_join(username, host, self.store);
local list, err = datamanager.list_open(username, host, self.store);
if not list then
if err == nil then
@@ -378,13 +379,14 @@ function archive:trim(username, to_when)
if i == 1 then return 0; end
local ok, err = datamanager.list_shift(username, host, self.store, i);
if not ok then return ok, err; end
+ archive_item_count_cache:set(cache_key, nil); -- TODO calculate how many items are left
return i-1;
end
function archive:delete(username, query)
local cache_key = jid_join(username, host, self.store);
if not query or next(query) == nil then
- archive_item_count_cache:set(cache_key, nil);
+ archive_item_count_cache:set(cache_key, nil); -- nil because we don't check if the following succeeds
return datamanager.list_store(username, host, self.store, nil);
end