# HG changeset patch # User Kim Alvefur # Date 1623152020 -7200 # Node ID 19aac4247b03915d384b9c7d8f5db59b65931ff2 # Parent 0db763f3f3bef5e55641b2438fc030bbbf43750f 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} diff -r 0db763f3f3be -r 19aac4247b03 plugins/mod_http_file_share.lua --- 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