Software / code / prosody
Comparison
plugins/mod_http_file_share.lua @ 11992:876e1b6d6ae4
mod_http_file_share: Limit query to time since last expiry
This is probably a bad idea, as files that could not be deleted for some
reason will not be tried again. I was just thinking of what the 'task'
argument could be used for.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 30 Nov 2021 00:52:07 +0100 |
| parent | 11990:6f4790b8deec |
| child | 11993:aa60f4353001 |
comparison
equal
deleted
inserted
replaced
| 11991:bef2a59b00d1 | 11992:876e1b6d6ae4 |
|---|---|
| 455 wait(); | 455 wait(); |
| 456 end | 456 end |
| 457 | 457 |
| 458 local prune_start = module:measure("prune", "times"); | 458 local prune_start = module:measure("prune", "times"); |
| 459 | 459 |
| 460 module:daily("Remove expired files", function(_, boundary_time) | 460 module:daily("Remove expired files", function(task, boundary_time) |
| 461 local prune_done = prune_start(); | 461 local prune_done = prune_start(); |
| 462 local iter, total = assert(uploads:find(nil, {["end"] = boundary_time; total = true})); | 462 local iter, total = assert(uploads:find(nil, { ["start"] = task.last; ["end"] = boundary_time; total = true })); |
| 463 | 463 |
| 464 if total == 0 then | 464 if total == 0 then |
| 465 module:log("info", "No expired uploaded files to prune"); | 465 module:log("info", "No expired uploaded files to prune"); |
| 466 prune_done(); | 466 prune_done(); |
| 467 return; | 467 return; |