Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(onboarding): deprecate misleading retentionPeriodHrs key #20798

Merged
merged 5 commits into from
Mar 1, 2021

Conversation

danxmoran
Copy link
Contributor

Closes #20452

Using seconds as the unit matches the create-bucket API. Need to open a matching PR in Cloud

@danxmoran danxmoran force-pushed the dm-onboarding-retention-period-fix-name-20452 branch from bfd1615 to 4b8e2b1 Compare February 26, 2021 21:29
Copy link
Contributor

@davidby-influx davidby-influx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small suggestions, not blocking in any way.

}

if setupFlags.retention != "" {
dur, err := internal2.RawDurationToTimeDuration(setupFlags.retention)
if err != nil {
return nil, err
}
req.RetentionPeriod = dur
secs := dur / time.Second
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better here to use the Duration.Seconds() and Duration.Nanoseconds() to hide the internal representation in the Duration? The modulo will have to change, if you do this, of course.

}

if options.target.retention != "" {
dur, err := internal.RawDurationToTimeDuration(options.target.retention)
if err != nil {
return nil, err
}
req.RetentionPeriod = dur
secs := dur / time.Second
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, can you use the Duration.Seconds() call?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a good idea, I'll play with the math

onboarding.go Outdated
Org string `json:"org"`
Bucket string `json:"bucket"`
RetentionPeriodSeconds int64 `json:"retentionPeriodSeconds,omitempty"`
RetentionPeriodHours time.Duration `json:"retentionPeriodHrs,omitempty"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review: I meant to name this RetentionPeriodDeprecated to emphasize that it's not actually hours

@danxmoran danxmoran merged commit d4a0c34 into master Mar 1, 2021
@danxmoran danxmoran deleted the dm-onboarding-retention-period-fix-name-20452 branch March 1, 2021 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

retentionPeriodHrs key in onboarding requests is misleading
2 participants