-
Notifications
You must be signed in to change notification settings - Fork 7
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
moved frequency time logic into the parser method #21 #23
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is better 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny nitpick but otherwise this is awesome. Thanks!
configparser/configparser.go
Outdated
readabletime, _ := time.ParseDuration(freq) | ||
|
||
// If the time specified is less than 1 second, treat the value as seconds | ||
if readabletime <= time.Duration(1000000000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for readability, can this be written as 1 * time.Second ?
configparser/configparser.go
Outdated
log.Println("The value of Frequency was not valid, defaulting to 1m from", freq) | ||
} else { | ||
// Convert the nanoseconds to seconds | ||
readabletime = time.Duration(intreadable * 1000000000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. I guess the 1 *
may be unnecessary so just * time.Second
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
This implements a new field in the sink Struct called TimeFrequency and moved the logic added into the Sinkworker to the Configparser in a new function to then populate the TimeFrequency field of the sink struct with a time.Durration type value for use elsewhere.