Mercurial > prosody-modules
changeset 2682:3fd50495c89d
mod_http_upload: Clear unused slots after 15 minutes
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 13 Apr 2017 20:26:24 +0200 |
parents | 8d8ba28d020f |
children | d0948bd96a7b |
files | mod_http_upload/mod_http_upload.lua |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_http_upload/mod_http_upload.lua Thu Apr 13 20:59:55 2017 +0200 +++ b/mod_http_upload/mod_http_upload.lua Thu Apr 13 20:26:24 2017 +0200 @@ -152,6 +152,11 @@ filename = join_path(storage_path, random_dir, filename), size = filesize, time = os.time() }); local slot = random_dir.."/"..filename; pending_slots[slot] = origin.full_jid; + + module:add_timer(900, function() + pending_slots[slot] = nil; + end); + local base_url = module:http_url(); local slot_url = url.parse(base_url); slot_url.path = url.parse_path(slot_url.path or "/");