From eb519e0752d3cf7f5f8daeefd4ad9bd29cbfa8c2 Mon Sep 17 00:00:00 2001 From: ldelossa Date: Mon, 8 Feb 2021 11:41:16 -0500 Subject: [PATCH] config: allow gc to be disabled Signed-off-by: ldelossa --- Documentation/reference/config.md | 2 ++ config/matcher.go | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/reference/config.md b/Documentation/reference/config.md index ded7170cb0..e7bcb41baf 100644 --- a/Documentation/reference/config.md +++ b/Documentation/reference/config.md @@ -221,6 +221,8 @@ Sets the number of update operations to retain between garbage collection cycles This should be set to a safe MAX value based on database size constraints. Defaults to 10 + +If a value of 0 is provided GC is disabled. ``` ### notifier: \ diff --git a/config/matcher.go b/config/matcher.go index aa20f75712..0fce28829d 100644 --- a/config/matcher.go +++ b/config/matcher.go @@ -43,6 +43,8 @@ type Matcher struct { // // The lowest possible value is 2 in order to compare updates for notification // purposes. + // + // A value of 0 disables GC. UpdateRetention int `yaml:"update_retention" json:"update_retention"` } @@ -65,7 +67,7 @@ func (m *Matcher) Validate() error { if m.Period == 0 { m.Period = DefaultPeriod } - if m.UpdateRetention < 2 { + if m.UpdateRetention == 1 || m.UpdateRetention < 0 { m.UpdateRetention = DefaultRetention } return nil