Changeset

11355:89efa3f2966b

mod_http_file_share: Collect statistics of files uploaded
author Kim Alvefur <zash@zash.se>
date Tue, 02 Feb 2021 22:08:51 +0100
parents 11354:10fba62332c5
children 11356:43e5429ab355
files plugins/mod_http_file_share.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_http_file_share.lua	Mon Feb 01 12:47:05 2021 +0100
+++ b/plugins/mod_http_file_share.lua	Tue Feb 02 22:08:51 2021 +0100
@@ -62,6 +62,8 @@
 local upload_cache = cache.new(1024);
 local quota_cache = cache.new(1024);
 
+local measure_uploads = module:measure("upload", "sizes");
+
 -- Convenience wrapper for logging file sizes
 local function B(bytes) return hi.format(bytes, "B", "b"); end
 
@@ -255,6 +257,7 @@
 		if uploaded then
 			module:log("debug", "Upload of %q completed, %s", filename, B(final_size));
 			assert(os.rename(filename.."~", filename));
+			measure_uploads(final_size);
 
 			upload_cache:set(upload_info.slot, {
 					name = upload_info.filename;