Software /
code /
prosody
Comparison
plugins/mod_http_file_share.lua @ 11406:9d6545a7d483
mod_http_file_share: Skip removal of nothing
In case none of the expired files could be deleted then it's a waste of
an API call to try to remove any of the metadata at all.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 26 Feb 2021 00:20:24 +0100 |
parent | 11405:ce8291e89d67 |
child | 11491:c3fb802f9e45 |
comparison
equal
deleted
inserted
replaced
11405:ce8291e89d67 | 11406:9d6545a7d483 |
---|---|
421 -- eventually the admin ought to notice and fix the permissions or | 421 -- eventually the admin ought to notice and fix the permissions or |
422 -- whatever the problem is. | 422 -- whatever the problem is. |
423 deletion_query = {ids = obsolete_uploads}; | 423 deletion_query = {ids = obsolete_uploads}; |
424 end | 424 end |
425 | 425 |
426 local removed, err = uploads:delete(nil, deletion_query); | 426 if #obsolete_uploads == 0 then |
427 | 427 module:log("debug", "No metadata to remove"); |
428 if removed == true or removed == n or removed == #obsolete_uploads then | |
429 module:log("debug", "Removed all metadata for expired uploaded files"); | |
430 else | 428 else |
431 module:log("error", "Problem removing metadata for deleted files: %s", err); | 429 local removed, err = uploads:delete(nil, deletion_query); |
430 | |
431 if removed == true or removed == n or removed == #obsolete_uploads then | |
432 module:log("debug", "Removed all metadata for expired uploaded files"); | |
433 else | |
434 module:log("error", "Problem removing metadata for deleted files: %s", err); | |
435 end | |
432 end | 436 end |
433 | 437 |
434 prune_done(); | 438 prune_done(); |
435 end); | 439 end); |
436 | 440 |