# HG changeset patch # User Kim Alvefur # Date 1631458982 -7200 # Node ID 5d925f340ae69cd90b5d6b368ae01e56240efec6 # Parent 9006ff4838ff90f9166c146e4f5a9b3f7b632f87 mod_http_file_share: Measure current total usage In order to allow monitoring. Especially as there's not much in the way of hard numbers on how much space gets used. diff -r 9006ff4838ff -r 5d925f340ae6 plugins/mod_http_file_share.lua --- a/plugins/mod_http_file_share.lua Sun Sep 12 15:47:06 2021 +0200 +++ b/plugins/mod_http_file_share.lua Sun Sep 12 17:03:02 2021 +0200 @@ -70,10 +70,17 @@ local measure_upload_cache_size = module:measure("upload_cache", "amount"); local measure_quota_cache_size = module:measure("quota_cache", "amount"); +local measure_total_storage_usage = nil; +if total_storage_limit then + measure_total_storage_usage = module:measure("total_storage", "amount", { unit = "bytes" }); +end module:hook_global("stats-update", function () measure_upload_cache_size(upload_cache:count()); measure_quota_cache_size(quota_cache:count()); + if total_storage_limit then + measure_total_storage_usage(total_storage_usage); + end end); local buckets = {};