mod_http_file_share: Retrieve stored total in async-friendly way
Does this run in a thread?
--- 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());