Skip to content

Conversation

@easwars
Copy link
Contributor

@easwars easwars commented Sep 25, 2023

Fixes #5813

RELEASE NOTES: none

@easwars easwars requested a review from dfawley September 25, 2023 17:01
@easwars easwars added the Type: Internal Cleanup Refactors, etc label Sep 25, 2023
@easwars easwars added this to the 1.59 Release milestone Sep 25, 2023
Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

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

LGTM in concept. Some suggestions for the API itself. I especially find it odd that the error is not returned by RunF, but that isn't necessarily a problem, as you can set things in the f closure you pass.

@dfawley dfawley assigned easwars and unassigned dfawley Sep 25, 2023
@easwars easwars assigned dfawley and unassigned easwars Sep 25, 2023
orca/producer.go Outdated
if resetBackoff {
retErr = backoff.ErrResetBackoff
}
if code := status.Code(err); code == codes.Unavailable || code == codes.Canceled {
Copy link
Member

Choose a reason for hiding this comment

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

Reworking the ordering here should simplify a little:

if code := status.Code(err); code != Unavailable && code != Canceled {
	logger.Error()
}
if resetBackoff {
	return backoff.ErrResetBackoff
}
return nil

@dfawley dfawley assigned easwars and unassigned dfawley Sep 25, 2023
@easwars easwars merged commit 57cb4d8 into grpc:master Sep 26, 2023
@easwars easwars deleted the backoff_func branch September 26, 2023 18:10
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a helper to run an arbitrary function with backoff

2 participants