Changeset

12005:797197b8607e

mod_http_file_share: Fix deletion counter Before aa60f4353001 each loop had its own counter, seems incrementing of one of them was lost. But only one is needed anyhow.
author Kim Alvefur <zash@zash.se>
date Sat, 04 Dec 2021 14:28:04 +0100
parents 12004:a2a0e00cbd24
children 12006:62a466e60515
files plugins/mod_http_file_share.lua
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_http_file_share.lua	Fri Dec 03 10:43:02 2021 +0100
+++ b/plugins/mod_http_file_share.lua	Sat Dec 04 14:28:04 2021 +0100
@@ -478,12 +478,11 @@
 		end
 
 		local obsolete_uploads = array();
-		local i = 0;
+		local n = 0;
 		local size_sum = 0;
-		local n = 0;
 		local problem_deleting = false;
 		for slot_id, slot_info in iter do
-			i = i + 1;
+			n = n + 1;
 			upload_cache:set(slot_id, nil);
 			local filename = get_filename(slot_id);
 			local deleted, err, errno = os.remove(filename);
@@ -494,7 +493,7 @@
 				module:log("error", "Could not delete file %q: %s", filename, err);
 				problem_deleting = true;
 			end
-			if i % 100 == 0 then sleep(0.1); end
+			if n % 100 == 0 then sleep(0.1); end
 		end
 
 		-- obsolete_uploads now contains slot ids for which the files have been