Skip to content

Commit 7e43dca

Browse files
authored
Move constants closer to their usage (#33)
1 parent 64e26f8 commit 7e43dca

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

rules/msk_topic_config.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,6 @@ func (r *MSKTopicConfigRule) getAndValidateCleanupPolicyValue(
341341

342342
const (
343343
retentionTimeAttr = "retention.ms"
344-
millisInOneHour = 60 * 60 * 1000
345-
millisInOneDay = 24 * millisInOneHour
346-
millisInOneMonth = 30 * millisInOneDay
347-
millisInOneYear = 365 * millisInOneDay
348344
// The threshold on retention time when remote storage is supported.
349345
tieredStorageThresholdInDays = 3
350346
tieredStorageEnableAttr = "remote.storage.enable"

rules/msk_topic_config_comments.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,13 @@ func round(val float64) float64 {
405405
return math.Round(val*10) / 10
406406
}
407407

408+
const (
409+
millisInOneHour = 60 * 60 * 1000
410+
millisInOneDay = 24 * millisInOneHour
411+
millisInOneMonth = 30 * millisInOneDay
412+
millisInOneYear = 365 * millisInOneDay
413+
)
414+
408415
func determineTimeUnits(millis int) (float64, string) {
409416
floatMillis := float64(millis)
410417
timeInYears := round(floatMillis / millisInOneYear)

0 commit comments

Comments
 (0)