Changeset

11594:19aac4247b03

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}
author Kim Alvefur <zash@zash.se>
date Tue, 08 Jun 2021 13:33:40 +0200
parents 11593:0db763f3f3be
children 11595:8985efc6792d
files plugins/mod_http_file_share.lua
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_http_file_share.lua	Tue Jun 08 00:58:27 2021 +0200
+++ b/plugins/mod_http_file_share.lua	Tue Jun 08 13:33:40 2021 +0200
@@ -71,7 +71,13 @@
 	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