# HG changeset patch # User Kim Alvefur # Date 1492264289 -7200 # Node ID ef80c9d0ebff60b092b4ae368a6b4ddec8f3d8d6 # Parent 5f0b755b42a3420f3ab3c76be2e977e6b781494f mod_http_upload: Remove unused upload slots diff -r 5f0b755b42a3 -r ef80c9d0ebff mod_http_upload/mod_http_upload.lua --- a/mod_http_upload/mod_http_upload.lua Sat Apr 15 15:35:55 2017 +0200 +++ b/mod_http_upload/mod_http_upload.lua Sat Apr 15 15:51:29 2017 +0200 @@ -79,6 +79,7 @@ if not uploads then return true; end uploads = array(uploads); local expiry = os.time() - max_age; + local upload_window = os.time() - 900; uploads:filter(function (item) if item.time < expiry then local deleted, whynot = os.remove(item.filename); @@ -86,6 +87,8 @@ module:log("warn", "Could not delete expired upload %s: %s", item.filename, whynot or "delete failed"); end return false; + elseif item.time < upload_window and not lfs.attributes(item.filename) then + return false; -- File was not uploaded or has been deleted since end return true; end);