Changeset

11347:5b3ad3c7fe47

mod_http_file_share: Split out some variables for later reuse
author Kim Alvefur <zash@zash.se>
date Sun, 31 Jan 2021 17:56:35 +0100
parents 11346:315faec1a920
children 11348:f076199b4d38
files plugins/mod_http_file_share.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_http_file_share.lua	Sun Jan 31 14:43:42 2021 +0100
+++ b/plugins/mod_http_file_share.lua	Sun Jan 31 17:56:35 2021 +0100
@@ -70,7 +70,9 @@
 
 -- TODO cache
 function get_daily_quota(uploader)
-	local iter, err = uploads:find(nil, {with = uploader; start = os.time() - 86400});
+	local now = os.time();
+	local max_age = now - 86400;
+	local iter, err = uploads:find(nil, {with = uploader; start = max_age });
 	if not iter then return iter, err; end
 	local total_bytes = 0;
 	for _, slot in iter do