aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_http_file_share.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-11-30 00:55:54 +0100
committerKim Alvefur <zash@zash.se>2021-11-30 00:55:54 +0100
commit82f6358657d85762ece207a1ff9aba18150f22f3 (patch)
tree2b76fa9dbd02bae2a287babd6c407b804e4b1be3 /plugins/mod_http_file_share.lua
parentd2f4a57bfc2c51958a63ac2475376cc3e5ba3e4f (diff)
downloadprosody-82f6358657d85762ece207a1ff9aba18150f22f3.tar.gz
prosody-82f6358657d85762ece207a1ff9aba18150f22f3.zip
mod_http_file_share: Keep global storage use accurate longer.
Merging those loops removes the miscounting that would occur in case a file could not be deleted, so no need to limit it to that case.
Diffstat (limited to 'plugins/mod_http_file_share.lua')
-rw-r--r--plugins/mod_http_file_share.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua
index bec56cd5..4fc5a3b5 100644
--- a/plugins/mod_http_file_share.lua
+++ b/plugins/mod_http_file_share.lua
@@ -500,10 +500,6 @@ if expiry >= 0 and not external_base_url then
local deletion_query = {["end"] = boundary_time};
if not problem_deleting then
module:log("info", "All (%d, %s) expired files successfully deleted", n, B(size_sum));
- if total_storage_usage then
- total_storage_usage = total_storage_usage - size_sum;
- module:log("debug", "Global quota %s / %s", B(total_storage_usage), B(total_storage_limit));
- end
-- we can delete based on time
else
module:log("warn", "%d out of %d expired files could not be deleted", n-#obsolete_uploads, n);
@@ -511,10 +507,14 @@ if expiry >= 0 and not external_base_url then
-- successfully deleted, and then try again with the failed ones.
-- eventually the admin ought to notice and fix the permissions or
-- whatever the problem is.
- -- total_storage_limit will be inaccurate until this has been resolved
deletion_query = {ids = obsolete_uploads};
end
+ if total_storage_usage then
+ total_storage_usage = total_storage_usage - size_sum;
+ module:log("debug", "Global quota %s / %s", B(total_storage_usage), B(total_storage_limit));
+ end
+
if #obsolete_uploads == 0 then
module:log("debug", "No metadata to remove");
else