From 00a654845f8ea338dc87c1f3ca600e091ced2f6d Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 22 Aug 2016 12:19:19 +0000 Subject: [PATCH] cmd/syncthing: Remove old temp index dbs on startup (fixes #3529) GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3532 --- cmd/syncthing/main.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index 15b518e1f..d3cded6ff 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -1124,15 +1124,16 @@ func autoUpgrade(cfg *config.Wrapper) { // suitable time after they have gone out of fashion. func cleanConfigDirectory() { patterns := map[string]time.Duration{ - "panic-*.log": 7 * 24 * time.Hour, // keep panic logs for a week - "audit-*.log": 7 * 24 * time.Hour, // keep audit logs for a week - "index": 14 * 24 * time.Hour, // keep old index format for two weeks - "index-v0.11.0.db": 14 * 24 * time.Hour, // keep old index format for two weeks - "index-v0.13.0.db": 14 * 24 * time.Hour, // keep old index format for two weeks - "index*.converted": 14 * 24 * time.Hour, // keep old converted indexes for two weeks - "config.xml.v*": 30 * 24 * time.Hour, // old config versions for a month - "*.idx.gz": 30 * 24 * time.Hour, // these should for sure no longer exist - "backup-of-v0.8": 30 * 24 * time.Hour, // these neither + "panic-*.log": 7 * 24 * time.Hour, // keep panic logs for a week + "audit-*.log": 7 * 24 * time.Hour, // keep audit logs for a week + "index": 14 * 24 * time.Hour, // keep old index format for two weeks + "index-v0.11.0.db": 14 * 24 * time.Hour, // keep old index format for two weeks + "index-v0.13.0.db": 14 * 24 * time.Hour, // keep old index format for two weeks + "index*.converted": 14 * 24 * time.Hour, // keep old converted indexes for two weeks + "config.xml.v*": 30 * 24 * time.Hour, // old config versions for a month + "*.idx.gz": 30 * 24 * time.Hour, // these should for sure no longer exist + "backup-of-v0.8": 30 * 24 * time.Hour, // these neither + "tmp-index-sorter.*": time.Minute, // these should never exist on startup } for pat, dur := range patterns {