# HG changeset patch # User Kim Alvefur # Date 1638624484 -3600 # Node ID 797197b8607e5d208aca9d47f7afbc4884deff07 # Parent a2a0e00cbd24e3bd83489f3d1dc6c8fd8bdf0f3d 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. diff -r a2a0e00cbd24 -r 797197b8607e plugins/mod_http_file_share.lua --- 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