diff options
author | Kim Alvefur <zash@zash.se> | 2019-01-06 09:44:55 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-01-06 09:44:55 +0100 |
commit | d9e14b0e994443bb64eaae05b080a44929b8d03d (patch) | |
tree | 3db97a815c50038b9b3a54a06bdc5d4e34859c3c | |
parent | fa09b8372d173408df3cb468d9e1b5098c783f31 (diff) | |
download | prosody-d9e14b0e994443bb64eaae05b080a44929b8d03d.tar.gz prosody-d9e14b0e994443bb64eaae05b080a44929b8d03d.zip |
mod_mam: Handle expiry of messages that expire in the middle of the cut-off day
-rw-r--r-- | plugins/mod_mam/mod_mam.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua index 5ba04d68..d2ca709b 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua @@ -358,14 +358,18 @@ if cleanup_after ~= "never" then local users = {}; local cut_off = datestamp(os.time() - cleanup_after); for date in cleanup_storage:users() do - if date < cut_off then + if date <= cut_off then module:log("debug", "Messages from %q should be expired", date); local messages_this_day = cleanup_storage:get(date); if messages_this_day then for user in pairs(messages_this_day) do users[user] = true; end - cleanup_storage:set(date, nil); + if date < cut_off then + -- Messages from the same day as the cut-off might not have expired yet, + -- but all earlier will have, so clear storage for those days. + cleanup_storage:set(date, nil); + end end end end |