aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-05-27 19:17:12 +0200
committerKim Alvefur <zash@zash.se>2019-05-27 19:17:12 +0200
commit11d7a43acb43ea908d48dc62ab1e2871a08b4834 (patch)
treeff8dba22a43f87b20109ab298eb508300dd1ffe9 /plugins
parent52cd135a6cf1751abd6bf870eb5183b1bec3bfca (diff)
parente96902f6b477fe31d599ae9abf50e9baf0489d50 (diff)
downloadprosody-11d7a43acb43ea908d48dc62ab1e2871a08b4834.tar.gz
prosody-11d7a43acb43ea908d48dc62ab1e2871a08b4834.zip
Merge 0.11->trunk
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_mam/mod_mam.lua9
-rw-r--r--plugins/mod_muc_mam.lua8
2 files changed, 14 insertions, 3 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua
index 317ddac1..4e0cf531 100644
--- a/plugins/mod_mam/mod_mam.lua
+++ b/plugins/mod_mam/mod_mam.lua
@@ -43,7 +43,6 @@ local archive = module:open_store(archive_store, "archive");
local cleanup_after = module:get_option_string("archive_expires_after", "1w");
local cleanup_interval = module:get_option_number("archive_cleanup_interval", 4 * 60 * 60);
local archive_item_limit = module:get_option_number("storage_archive_item_limit", archive.caps and archive.caps.quota or 1000);
-
if not archive.find then
error("mod_"..(archive._provided_by or archive.name and "storage_"..archive.name).." does not support archiving\n"
.."See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information");
@@ -375,9 +374,15 @@ if cleanup_after ~= "never" then
-- messages, we collect the union of sets of users from dates that fall
-- outside the cleanup range.
+ local last_date = require "util.cache".new(module:get_option_number("archive_cleanup_date_cache_size", 1000));
function schedule_cleanup(username, date)
- cleanup_map:set(date or datestamp(), username, true);
+ date = date or datestamp();
+ if last_date:get(username) == date then return end
+ local ok = cleanup_map:set(date, username, true);
+ if ok then
+ last_date:set(username, date);
end
+ end
local cleanup_time = module:measure("cleanup", "times");
cleanup_runner = require "util.async".runner(function ()
diff --git a/plugins/mod_muc_mam.lua b/plugins/mod_muc_mam.lua
index bba7f422..eb93a386 100644
--- a/plugins/mod_muc_mam.lua
+++ b/plugins/mod_muc_mam.lua
@@ -458,8 +458,14 @@ if cleanup_after ~= "never" then
-- messages, we collect the union of sets of rooms from dates that fall
-- outside the cleanup range.
+ local last_date = require "util.cache".new(module:get_option_number("muc_log_cleanup_date_cache_size", 1000));
function schedule_cleanup(roomname, date)
- cleanup_map:set(date or datestamp(), roomname, true);
+ date = date or datestamp();
+ if last_date:get(roomname) == date then return end
+ local ok = cleanup_map:set(date, roomname, true);
+ if ok then
+ last_date:set(roomname, date);
+ end
end
cleanup_runner = require "util.async".runner(function ()