# HG changeset patch # User Kim Alvefur # Date 1638230154 -3600 # Node ID f9b2325f6b50bafb1c5d8cd5057ada6a953541df # Parent aa60f4353001b3cde6e5d6996ec24c9926b93e53 mod_http_file_share: Keep global storage use accurate longer. Merging those loops removes the miscounting that would occur in case a file could not be deleted, so no need to limit it to that case. diff -r aa60f4353001 -r f9b2325f6b50 plugins/mod_http_file_share.lua --- a/plugins/mod_http_file_share.lua Tue Nov 30 00:53:22 2021 +0100 +++ b/plugins/mod_http_file_share.lua Tue Nov 30 00:55:54 2021 +0100 @@ -500,10 +500,6 @@ local deletion_query = {["end"] = boundary_time}; if not problem_deleting then module:log("info", "All (%d, %s) expired files successfully deleted", n, B(size_sum)); - if total_storage_usage then - total_storage_usage = total_storage_usage - size_sum; - module:log("debug", "Global quota %s / %s", B(total_storage_usage), B(total_storage_limit)); - end -- we can delete based on time else module:log("warn", "%d out of %d expired files could not be deleted", n-#obsolete_uploads, n); @@ -511,10 +507,14 @@ -- successfully deleted, and then try again with the failed ones. -- eventually the admin ought to notice and fix the permissions or -- whatever the problem is. - -- total_storage_limit will be inaccurate until this has been resolved deletion_query = {ids = obsolete_uploads}; end + if total_storage_usage then + total_storage_usage = total_storage_usage - size_sum; + module:log("debug", "Global quota %s / %s", B(total_storage_usage), B(total_storage_limit)); + end + if #obsolete_uploads == 0 then module:log("debug", "No metadata to remove"); else