From d1fdbd5080a19fe0bc9d273466bd5e65532644a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 10 Oct 2017 12:51:43 +0200 Subject: [PATCH] More lenient check for unrendered timelapses Only delete automatically if modification AND creation date are older than the calculated cutoff. --- src/octoprint/timelapse.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/octoprint/timelapse.py b/src/octoprint/timelapse.py index a3cff03e..7d203c4c 100644 --- a/src/octoprint/timelapse.py +++ b/src/octoprint/timelapse.py @@ -194,7 +194,8 @@ def delete_old_unrendered_timelapses(): if prefix in prefixes_to_clean: continue - if entry.stat().st_mtime < cutoff: + # delete if both creation and modification time are older than the cutoff + if max(entry.stat().st_ctime, entry.stat().st_mtime) < cutoff: prefixes_to_clean.append(prefix) except: if logging.getLogger(__name__).isEnabledFor(logging.DEBUG):