mod_http_file_share: Improve consistency of terminology in logging
authorKim Alvefur <zash@zash.se>
Sat, 04 Dec 2021 15:03:26 +0100
changeset 12011 dc72581e04ff
parent 12010 62a466e60515
child 12012 c01532ae6a3b
mod_http_file_share: Improve consistency of terminology in logging Prefer 'prune' over 'delete' since it more strongly implies removal of excess.
plugins/mod_http_file_share.lua
--- a/plugins/mod_http_file_share.lua	Sat Dec 04 15:03:52 2021 +0100
+++ b/plugins/mod_http_file_share.lua	Sat Dec 04 15:03:26 2021 +0100
@@ -486,27 +486,27 @@
 			upload_cache:set(slot_id, nil);
 			local filename = get_filename(slot_id);
 			local deleted, err, errno = os.remove(filename);
-			if deleted or errno == ENOENT then
+			if deleted or errno == ENOENT then -- removed successfully or it was already gone
 				size_sum = size_sum + tonumber(slot_info.attr.size);
 				obsolete_uploads:push(slot_id);
 			else
-				module:log("error", "Could not delete file %q: %s", filename, err);
+				module:log("error", "Could not prune expired file %q: %s", filename, err);
 				problem_deleting = true;
 			end
 			if num_expired % 100 == 0 then sleep(0.1); end
 		end
 
 		-- obsolete_uploads now contains slot ids for which the files have been
-		-- deleted and that needs to be cleared from the database
+		-- removed and that needs to be cleared from the database
 
 		local deletion_query = {["end"] = boundary_time};
 		if not problem_deleting then
-			module:log("info", "All (%d, %s) expired files successfully deleted", num_expired, B(size_sum));
+			module:log("info", "All (%d, %s) expired files successfully pruned", num_expired, B(size_sum));
 			-- we can delete based on time
 		else
-			module:log("warn", "%d out of %d expired files could not be deleted", num_expired-#obsolete_uploads, num_expired);
+			module:log("warn", "%d out of %d expired files could not be pruned", num_expired-#obsolete_uploads, num_expired);
 			-- we'll need to delete only those entries where the files were
-			-- successfully deleted, and then try again with the failed ones.
+			-- successfully removed, and then try again with the failed ones.
 			-- eventually the admin ought to notice and fix the permissions or
 			-- whatever the problem is.
 			deletion_query = {ids = obsolete_uploads};
@@ -524,9 +524,9 @@
 			local removed, err = uploads:delete(nil, deletion_query);
 
 			if removed == true or removed == num_expired or removed == #obsolete_uploads then
-				module:log("debug", "Removed all metadata for expired uploaded files");
+				module:log("debug", "Expired upload metadata pruned successfully");
 			else
-				module:log("error", "Problem removing metadata for deleted files: %s", err);
+				module:log("error", "Problem removing metadata for expired files: %s", err);
 			end
 		end