aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-11-22 14:54:32 +0100
committerKim Alvefur <zash@zash.se>2021-11-22 14:54:32 +0100
commita70a8c4ffce9d970cf5611a2a32c2434df01d4ae (patch)
treee56d69a13aa2336b92f4cfefc114ef0061d8d696 /plugins
parent16c2ef22e048290e88134877c0104d3263481862 (diff)
downloadprosody-a70a8c4ffce9d970cf5611a2a32c2434df01d4ae.tar.gz
prosody-a70a8c4ffce9d970cf5611a2a32c2434df01d4ae.zip
mod_http_file_share: Switch to mod_cron for periodic tasks
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_http_file_share.lua19
1 files changed, 5 insertions, 14 deletions
diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua
index a5ac287c..5f3c8e5e 100644
--- a/plugins/mod_http_file_share.lua
+++ b/plugins/mod_http_file_share.lua
@@ -457,7 +457,7 @@ if expiry >= 0 and not external_base_url then
local prune_start = module:measure("prune", "times");
- local reaper_task = async.runner(function(boundary_time)
+ module:daily("Remove expired files", function(_, boundary_time)
local prune_done = prune_start();
local iter, total = assert(uploads:find(nil, {["end"] = boundary_time; total = true}));
@@ -468,8 +468,10 @@ if expiry >= 0 and not external_base_url then
end
module:log("info", "Pruning expired files uploaded earlier than %s", dt.datetime(boundary_time));
- if total_storage_limit then
+ if total_storage_usage then
module:log("debug", "Global quota %s / %s", B(total_storage_usage), B(total_storage_limit));
+ elseif total_storage_limit then
+ module:log("debug", "Global quota %s / %s", "not yet calculated", B(total_storage_limit));
end
local obsolete_uploads = array();
@@ -533,19 +535,12 @@ if expiry >= 0 and not external_base_url then
prune_done();
end);
-
- module:add_timer(5, function ()
- reaper_task:run(os.time()-expiry);
- return 60*60;
- end);
end
if total_storage_limit then
- local async = require "util.async";
-
local summary_start = module:measure("summary", "times");
- local summarizer_task = async.runner(function()
+ module:daily("Global quota check", function()
local summary_done = summary_start();
local iter = assert(uploads:find(nil));
@@ -561,10 +556,6 @@ if total_storage_limit then
summary_done();
end);
- module:add_timer(1, function()
- summarizer_task:run(true);
- return 11 * 60 * 60;
- end);
end
-- Reachable from the console