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

moved frequency time logic into the parser method #21 #23

Merged
merged 2 commits into from
Jan 15, 2020

Conversation

markercm
Copy link
Contributor

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.

Copy link
Contributor

@grep-ir grep-ir left a comment

Choose a reason for hiding this comment

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

This is better 👍

Copy link
Contributor

@chrisjohnson chrisjohnson left a 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!

readabletime, _ := time.ParseDuration(freq)

// If the time specified is less than 1 second, treat the value as seconds
if readabletime <= time.Duration(1000000000) {
Copy link
Contributor

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 ?

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)
Copy link
Contributor

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?

Copy link
Contributor

@chrisjohnson chrisjohnson left a comment

Choose a reason for hiding this comment

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

🎉

@markercm markercm merged commit c7ae91a into master Jan 15, 2020
@markercm markercm deleted the changing_frequency_time_to_parser branch January 15, 2020 15:54
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.

None yet

3 participants