comparison mod_http_upload/mod_http_upload.lua @ 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
comparison
equal deleted inserted replaced
2681:8d8ba28d020f 2682:3fd50495c89d
150 150
151 datamanager.list_append(origin.username, origin.host, module.name, { 151 datamanager.list_append(origin.username, origin.host, module.name, {
152 filename = join_path(storage_path, random_dir, filename), size = filesize, time = os.time() }); 152 filename = join_path(storage_path, random_dir, filename), size = filesize, time = os.time() });
153 local slot = random_dir.."/"..filename; 153 local slot = random_dir.."/"..filename;
154 pending_slots[slot] = origin.full_jid; 154 pending_slots[slot] = origin.full_jid;
155
156 module:add_timer(900, function()
157 pending_slots[slot] = nil;
158 end);
159
155 local base_url = module:http_url(); 160 local base_url = module:http_url();
156 local slot_url = url.parse(base_url); 161 local slot_url = url.parse(base_url);
157 slot_url.path = url.parse_path(slot_url.path or "/"); 162 slot_url.path = url.parse_path(slot_url.path or "/");
158 t_insert(slot_url.path, random_dir); 163 t_insert(slot_url.path, random_dir);
159 t_insert(slot_url.path, filename); 164 t_insert(slot_url.path, filename);