fix: increase default delete retention to 15 months (#10252)
365 + 90 days = 10920h. Also, actually enforce the minimum interval of 24h.
This commit is contained in:
@@ -17,14 +17,17 @@ import (
|
||||
"github.com/syncthing/syncthing/internal/slogutil"
|
||||
)
|
||||
|
||||
const maxDBConns = 16
|
||||
const (
|
||||
maxDBConns = 16
|
||||
minDeleteRetention = 24 * time.Hour
|
||||
)
|
||||
|
||||
type DB struct {
|
||||
*baseDB
|
||||
|
||||
pathBase string
|
||||
deleteRetention time.Duration
|
||||
|
||||
*baseDB
|
||||
|
||||
folderDBsMut sync.RWMutex
|
||||
folderDBs map[string]*folderDB
|
||||
folderDBOpener func(folder, path string, deleteRetention time.Duration) (*folderDB, error)
|
||||
@@ -36,7 +39,11 @@ type Option func(*DB)
|
||||
|
||||
func WithDeleteRetention(d time.Duration) Option {
|
||||
return func(s *DB) {
|
||||
s.deleteRetention = d
|
||||
if d <= 0 {
|
||||
s.deleteRetention = 0
|
||||
} else {
|
||||
s.deleteRetention = max(d, minDeleteRetention)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
internalMetaPrefix = "dbsvc"
|
||||
lastMaintKey = "lastMaint"
|
||||
defaultDeleteRetention = 180 * 24 * time.Hour
|
||||
minDeleteRetention = 24 * time.Hour
|
||||
internalMetaPrefix = "dbsvc"
|
||||
lastMaintKey = "lastMaint"
|
||||
)
|
||||
|
||||
func (s *DB) Service(maintenanceInterval time.Duration) suture.Service {
|
||||
|
||||
Reference in New Issue
Block a user