diff options
author | Kim Alvefur <zash@zash.se> | 2021-06-08 13:33:40 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-06-08 13:33:40 +0200 |
commit | 2f7da2c6ea762ccf72a9658ed2da163394652c16 (patch) | |
tree | b3fd7612c1144b3d32e5d3f8a42f03fbdf797a9f /plugins | |
parent | 4abc78fb2f0df4eb60fa62b8b7d79a7c361646d7 (diff) | |
download | prosody-2f7da2c6ea762ccf72a9658ed2da163394652c16.tar.gz prosody-2f7da2c6ea762ccf72a9658ed2da163394652c16.zip |
mod_http_file_share: Build list of measuring buckets for configured size limit
Creates buckets up to the configured size limit or 1TB, whichever is
smaller, e.g. {1K, 4K, 16K, ... 4M, 16M}
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_http_file_share.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua index ba6b97c5..d609b781 100644 --- a/plugins/mod_http_file_share.lua +++ b/plugins/mod_http_file_share.lua @@ -71,7 +71,13 @@ module:hook_global("stats-update", function () measure_quota_cache_size(quota_cache:count()); end); -local measure_uploads = module:measure("upload", "sizes"); +local buckets = {}; +for n = 10, 40, 2 do + local exp = math.floor(2 ^ n); + table.insert(buckets, exp); + if exp >= file_size_limit then break end +end +local measure_uploads = module:measure("upload", "sizes", {buckets = buckets}); -- Convenience wrapper for logging file sizes local function B(bytes) return hi.format(bytes, "B", "b"); end |