From ce345d2908c974438b5146a1187f6b83ac65cc7b Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 4 Dec 2021 15:03:26 +0100 Subject: 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 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua index 718ffb99..1a2a1f37 100644 --- a/plugins/mod_http_file_share.lua +++ b/plugins/mod_http_file_share.lua @@ -486,27 +486,27 @@ if expiry >= 0 and not external_base_url then 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 @@ if expiry >= 0 and not external_base_url then 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 -- cgit v1.2.3