Software /
code /
prosody
Comparison
plugins/mod_http_file_share.lua @ 11356:43e5429ab355
mod_http_file_share: Measure how long it takes to prune expired files
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 02 Feb 2021 22:11:53 +0100 |
parent | 11355:89efa3f2966b |
child | 11357:8cb2a64b15da |
comparison
equal
deleted
inserted
replaced
11355:89efa3f2966b | 11356:43e5429ab355 |
---|---|
352 wait(); | 352 wait(); |
353 end | 353 end |
354 | 354 |
355 local reaper_task = async.runner(function(boundary_time) | 355 local reaper_task = async.runner(function(boundary_time) |
356 local iter, total = assert(uploads:find(nil, {["end"] = boundary_time; total = true})); | 356 local iter, total = assert(uploads:find(nil, {["end"] = boundary_time; total = true})); |
357 local prune_done = module:measure("prune", "times"); | |
357 | 358 |
358 if total == 0 then | 359 if total == 0 then |
359 module:log("info", "No expired uploaded files to prune"); | 360 module:log("info", "No expired uploaded files to prune"); |
361 prune_done(); | |
360 return; | 362 return; |
361 end | 363 end |
362 | 364 |
363 module:log("info", "Pruning expired files uploaded earlier than %s", dt.datetime(boundary_time)); | 365 module:log("info", "Pruning expired files uploaded earlier than %s", dt.datetime(boundary_time)); |
364 | 366 |
398 module:log("debug", "Removed all metadata for expired uploaded files"); | 400 module:log("debug", "Removed all metadata for expired uploaded files"); |
399 else | 401 else |
400 module:log("error", "Problem removing metadata for deleted files: %s", err); | 402 module:log("error", "Problem removing metadata for deleted files: %s", err); |
401 end | 403 end |
402 | 404 |
405 prune_done(); | |
403 end); | 406 end); |
404 | 407 |
405 module:add_timer(1, function () | 408 module:add_timer(1, function () |
406 reaper_task:run(os.time()-expiry); | 409 reaper_task:run(os.time()-expiry); |
407 return 60*60; | 410 return 60*60; |