]> git.proxmox.com Git - proxmox.git/commit
rest server: log rotation: fix off-by-one for max_days
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 7 Apr 2022 10:57:03 +0000 (12:57 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 7 Apr 2022 10:58:32 +0000 (12:58 +0200)
commit5eaab7864ab95d680ed6de6f5a5d28daa37f4be0
tree4f1b02041a18ae99d8efae5b40be7d3ebfbe5961
parentbd8fd62de4c3ab79b5179b0baa61cf2b0c6047a5
rest server: log rotation: fix off-by-one for max_days

The entries in a file go from oldest end-time in the first time to
newest end-time in the last line. So, just because the first line is
older than the cut-off time, the remaining one doesn't necessarily
have to be old enough too. What we can know for sure that older than
the current checked rotations of the task archive are definitively up
for deletion.

Another possibility would be to check the last line, but as scanning
backwards is more expensive/complex to do while only being an actual
improvement in a very specific edge case (it's more likely to have a
mixed time-cutoff vs. task-log-file boundary than that those are
aligned)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
proxmox-rest-server/src/worker_task.rs