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
refactor: replace goto with for #85
Conversation
578b927
to
919a3f8
Compare
919a3f8
to
48b22d9
Compare
I'm personally not a huge fan of |
l.logF("%s attempt %d", l.conf.Owner, tries) | ||
if l.isBusyDeletingExpired() { | ||
l.logF("%s failed, waiting %s", l.conf.Owner, l.conf.RetryBackoff.String()) | ||
time.Sleep(l.conf.RetryBackoff) | ||
goto retry | ||
} |
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.
something to escape the loop is needed if not busy , could be a else+break or something similar
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.
what do you mean? the for condition will exit the loop
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.
if if l.isBusyDeletingExpired() {
is not true i think it should exit the loop and continue with the execution as it was doing with the goto
logic
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.
true! otherwise in case of long busy it will wait an extra time in the end before exiting
Co-authored-by: Roberto Santalla <roobre@users.noreply.github.com>
Co-authored-by: Guillermo Sanchez Gavier <gsanchez@newrelic.com>
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.
thanks!
publisher/lock/s3_lock.go
Outdated
if tries >= int(l.conf.MaxRetries) { | ||
break | ||
} |
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.
i think this could be removed , the for condition prevents this case
Replace goto with for as requested #83 (comment)
I still think this is one of the few legit usages of goto, making the code more readable in this case.
wdyt?