aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-02-02 22:08:51 +0100
committerKim Alvefur <zash@zash.se>2021-02-02 22:08:51 +0100
commitda5cd9c9630dde68a93d138fb78520b87fced747 (patch)
tree3ea65279221d25fe2f6c291570a2491dcf67ba28
parent0f0d32d335c2fb6bba59e5a6043412ad6d61e74a (diff)
downloadprosody-da5cd9c9630dde68a93d138fb78520b87fced747.tar.gz
prosody-da5cd9c9630dde68a93d138fb78520b87fced747.zip
mod_http_file_share: Collect statistics of files uploaded
-rw-r--r--plugins/mod_http_file_share.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua
index 99226508..275ebaff 100644
--- a/plugins/mod_http_file_share.lua
+++ b/plugins/mod_http_file_share.lua
@@ -62,6 +62,8 @@ local upload_errors = errors.init(module.name, namespace, {
local upload_cache = cache.new(1024);
local quota_cache = cache.new(1024);
+local measure_uploads = module:measure("upload", "sizes");
+
-- Convenience wrapper for logging file sizes
local function B(bytes) return hi.format(bytes, "B", "b"); end
@@ -255,6 +257,7 @@ function handle_upload(event, path) -- PUT /upload/:slot
if uploaded then
module:log("debug", "Upload of %q completed, %s", filename, B(final_size));
assert(os.rename(filename.."~", filename));
+ measure_uploads(final_size);
upload_cache:set(upload_info.slot, {
name = upload_info.filename;