Skip to content

Commit 1581ee1

Browse files
authored
[*] fix Reap() to handle --min-db-size-mb<8, closes #817 (#818)
1 parent d5ed1be commit 1581ee1

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

internal/reaper/reaper.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,11 @@ func (r *Reaper) Reap(ctx context.Context) {
117117
r.CreateSourceHelpers(ctx, srcL, monitoredSource)
118118

119119
if monitoredSource.IsPostgresSource() {
120-
if r.Sources.MinDbSizeMB >= 8 { // an empty DB is a bit less than 8MB
121-
DBSizeMB := monitoredSource.ApproxDbSize / 1048576 // only remove from monitoring when we're certain it's under the threshold
122-
if DBSizeMB != 0 && DBSizeMB < r.Sources.MinDbSizeMB {
123-
srcL.Infof("ignored due to the --min-db-size-mb filter, current size %d MB", DBSizeMB)
124-
hostsToShutDownDueToRoleChange[monitoredSource.Name] = true // for the case when DB size was previosly above the threshold
125-
continue
126-
}
120+
DBSizeMB := monitoredSource.ApproxDbSize / 1048576 // only remove from monitoring when we're certain it's under the threshold
121+
if DBSizeMB != 0 && DBSizeMB < r.Sources.MinDbSizeMB {
122+
srcL.Infof("ignored due to the --min-db-size-mb filter, current size %d MB", DBSizeMB)
123+
hostsToShutDownDueToRoleChange[monitoredSource.Name] = true // for the case when DB size was previosly above the threshold
124+
continue
127125
}
128126

129127
lastKnownStatusInRecovery := hostLastKnownStatusInRecovery[monitoredSource.Name]

0 commit comments

Comments
 (0)