fix: cleanup only old uploads, restore fav state on tinder undo
- #11: cleanup_old_uploads() skips dirs younger than 24h (safe during --reload) - #12: tinderHistory stores wasFav snapshot; undo restores exact pre-swipe favorite state Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -31,13 +31,18 @@ load_dotenv()
|
||||
|
||||
|
||||
def cleanup_old_uploads():
|
||||
"""Löscht beim Start alle alten onlyframes-tmp-Ordner."""
|
||||
"""Löscht onlyframes-tmp-Ordner die älter als 24h sind."""
|
||||
tmp = tempfile.gettempdir()
|
||||
cutoff = time() - 24 * 3600
|
||||
for name in os.listdir(tmp):
|
||||
if name.startswith("onlyframes-") and name != "onlyframes-server.log":
|
||||
path = os.path.join(tmp, name)
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(path, ignore_errors=True)
|
||||
try:
|
||||
if os.path.getmtime(path) < cutoff:
|
||||
shutil.rmtree(path, ignore_errors=True)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
cleanup_old_uploads()
|
||||
|
||||
Reference in New Issue
Block a user