# HG changeset patch # User Kim Alvefur # Date 1697316219 -7200 # Node ID 9c62ffbdf2aebb9bb09cd35c2585f29572ddcec9 # Parent 6ac5ad578565d21544ccef913fce1f9ac1ac9156 mod_http_file_share: Retrieve stored total in async-friendly way Does this run in a thread? diff -r 6ac5ad578565 -r 9c62ffbdf2ae plugins/mod_http_file_share.lua --- a/plugins/mod_http_file_share.lua Sat Oct 14 22:32:33 2023 +0200 +++ b/plugins/mod_http_file_share.lua Sat Oct 14 22:43:39 2023 +0200 @@ -79,12 +79,12 @@ local measure_quota_cache_size = module:measure("quota_cache", "amount"); local measure_total_storage_usage = module:measure("total_storage", "amount", { unit = "bytes" }); -do +module:once(function () local total, err = persist_stats:get(nil, "total"); if not err then total_storage_usage = tonumber(total) or 0; end -end +end) module:hook_global("stats-update", function () measure_upload_cache_size(upload_cache:count());