# HG changeset patch # User Kim Alvefur # Date 1567114542 -7200 # Node ID bb8a6df5ecba1454e7f58593a15690225dd08bde # Parent 02a1615d0392dd1561ea796be792433167c1a2aa mod_http_upload: Skip write if nothing expired when checking Reducing unnecessary IO is good. diff -r 02a1615d0392 -r bb8a6df5ecba mod_http_upload/mod_http_upload.lua --- a/mod_http_upload/mod_http_upload.lua Thu Aug 29 23:30:55 2019 +0200 +++ b/mod_http_upload/mod_http_upload.lua Thu Aug 29 23:35:42 2019 +0200 @@ -119,6 +119,7 @@ uploads = array(uploads); local expiry = os.time() - max_age; local upload_window = os.time() - 900; + local before = #uploads; uploads:filter(function (item) local filename = item.filename; if item.dir then @@ -136,6 +137,8 @@ end return true; end); + local after = #uploads; + if before == after then return true end -- nothing changed, skip write return datamanager.list_store(username, host, module.name, uploads); end