Skip to content
New issue

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

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

Already on GitHub? # to your account

added context cancelling support #86

Merged
merged 3 commits into from
Jun 1, 2019
Merged

Conversation

roblaszczak
Copy link
Member

No description provided.

return events, nil
}

elapsedTime := time.Now().Sub(startTime)

Choose a reason for hiding this comment

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

S1012: should use time.Since instead of time.Now().Sub (from gosimple)


startTime := time.Now()
_, _ = h(message.NewMessage("1", nil))
timeElapsed := time.Now().Sub(startTime)

Choose a reason for hiding this comment

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

S1012: should use time.Since instead of time.Now().Sub (from gosimple)


elapsedTime := time.Now().Sub(startTime)

if r.shouldRetry(retries, elapsedTime) {
Copy link
Member

Choose a reason for hiding this comment

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

How about changing this to avoid long nesting?

if !r.shouldRetry(...) {
    return
}

Copy link
Member

Choose a reason for hiding this comment

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

Or maybe break then and return at the end of the function.

@roblaszczak roblaszczak merged commit c041842 into master Jun 1, 2019
@roblaszczak roblaszczak deleted the retry-middleware-cancelling branch September 11, 2019 21:25
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants