Mercurial > prosody-hg
comparison plugins/mod_http_file_share.lua @ 13713:4a687745bb51 13.0
mod_http_file_share: Persist total storage usage when it increases (fixes #1891)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 15 Feb 2025 17:10:30 +0000 |
| parents | 7f05254fb042 |
| children | 977415e0122d |
comparison
equal
deleted
inserted
replaced
| 13711:12e0b61830c8 | 13713:4a687745bb51 |
|---|---|
| 222 origin.send(st.error_reply(stanza, storage_err)); | 222 origin.send(st.error_reply(stanza, storage_err)); |
| 223 return true; | 223 return true; |
| 224 end | 224 end |
| 225 | 225 |
| 226 total_storage_usage = total_storage_usage + filesize; | 226 total_storage_usage = total_storage_usage + filesize; |
| 227 persist_stats:set(nil, "total", total_storage_usage); | |
| 227 module:log("debug", "Total storage usage: %s / %s", B(total_storage_usage), B(total_storage_limit)); | 228 module:log("debug", "Total storage usage: %s / %s", B(total_storage_usage), B(total_storage_limit)); |
| 228 | 229 |
| 229 local cached_quota = quota_cache:get(uploader); | 230 local cached_quota = quota_cache:get(uploader); |
| 230 if cached_quota and cached_quota.time > os.time()-86400 then | 231 if cached_quota and cached_quota.time > os.time()-86400 then |
| 231 cached_quota.size = cached_quota.size + filesize; | 232 cached_quota.size = cached_quota.size + filesize; |
