From ce2aa9911a0c0b48f40f2a3db511c1c81844ed84 Mon Sep 17 00:00:00 2001 From: Richard Buckle Date: Wed, 12 Dec 2018 22:29:25 +0000 Subject: [PATCH] More aggressive purging of cached images Purge when 1 hr old, not 1 day. --- purgeConfigGraphics.sh | 2 +- purgePrivateConfigs.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/purgeConfigGraphics.sh b/purgeConfigGraphics.sh index 2d7ccdd..97d3622 100755 --- a/purgeConfigGraphics.sh +++ b/purgeConfigGraphics.sh @@ -2,4 +2,4 @@ DIR=`dirname "$0"` # purge all .jpg files over 1 day old -find "$DIR/www/configs" -name "*.jpg" \! \( -newerct '1 day ago' \) -delete +find "$DIR/www/configs" -name "*.jpg" \! \( -newerct '1 hour ago' \) -delete diff --git a/purgePrivateConfigs.py b/purgePrivateConfigs.py index c240150..f1e22f4 100755 --- a/purgePrivateConfigs.py +++ b/purgePrivateConfigs.py @@ -25,11 +25,11 @@ def hasReplay(self, bindPath): replayPath = self.replayPath(bindPath) return replayPath.exists() - def isOverOneDayOld(self, bindPath): + def isOverOneHourOld(self, bindPath): stat = bindPath.stat() fileTouchedTime = stat.st_ctime now = time.time() - cutoff = now - 86400 # bad practice but good enough for this + cutoff = now - 3600 return fileTouchedTime < cutoff def thoseWithoutReplay(self, bindingsPaths): @@ -49,7 +49,7 @@ def purge(self): sys.exit('%s not found' % self.configsDir) allBindings = self.allBindings() privateBindings = self.thoseWithoutReplay(allBindings) - oldPrivateBindings = [path for path in privateBindings if self.isOverOneDayOld(path)] + oldPrivateBindings = [path for path in privateBindings if self.isOverOneHourOld(path)] deepListToPurge = [self.allFilesStartingWithStem(path) for path in oldPrivateBindings] filesToPurge = [x for sublist in deepListToPurge for x in sublist] for path in filesToPurge: