Skip to content

Commit

Permalink
Move constants closer to their usage (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbuliarca authored Nov 6, 2024
1 parent 64e26f8 commit 7e43dca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 0 additions & 4 deletions rules/msk_topic_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,6 @@ func (r *MSKTopicConfigRule) getAndValidateCleanupPolicyValue(

const (
retentionTimeAttr = "retention.ms"
millisInOneHour = 60 * 60 * 1000
millisInOneDay = 24 * millisInOneHour
millisInOneMonth = 30 * millisInOneDay
millisInOneYear = 365 * millisInOneDay
// The threshold on retention time when remote storage is supported.
tieredStorageThresholdInDays = 3
tieredStorageEnableAttr = "remote.storage.enable"
Expand Down
7 changes: 7 additions & 0 deletions rules/msk_topic_config_comments.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,13 @@ func round(val float64) float64 {
return math.Round(val*10) / 10
}

const (
millisInOneHour = 60 * 60 * 1000
millisInOneDay = 24 * millisInOneHour
millisInOneMonth = 30 * millisInOneDay
millisInOneYear = 365 * millisInOneDay
)

func determineTimeUnits(millis int) (float64, string) {
floatMillis := float64(millis)
timeInYears := round(floatMillis / millisInOneYear)
Expand Down

0 comments on commit 7e43dca

Please sign in to comment.