diff options
author | Kim Alvefur <zash@zash.se> | 2023-10-14 22:43:39 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2023-10-14 22:43:39 +0200 |
commit | 320e215a794e1649bfcd06beef84438738196cc7 (patch) | |
tree | 8db5b3b4de6899177d226126d22cfaae1b01b384 /plugins/mod_http_file_share.lua | |
parent | 9f21d5487cb0291a156f9866bf9abb5e1d4e4ac6 (diff) | |
download | prosody-320e215a794e1649bfcd06beef84438738196cc7.tar.gz prosody-320e215a794e1649bfcd06beef84438738196cc7.zip |
mod_http_file_share: Retrieve stored total in async-friendly way
Does this run in a thread?
Diffstat (limited to 'plugins/mod_http_file_share.lua')
-rw-r--r-- | plugins/mod_http_file_share.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua index 6df9e3c3..b00bf1f9 100644 --- a/plugins/mod_http_file_share.lua +++ b/plugins/mod_http_file_share.lua @@ -79,12 +79,12 @@ 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 = 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()); |