Skip to content

fix(core): add retry to alter and run function #252

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

harshil-goel
Copy link
Contributor

No description provided.

@harshil-goel harshil-goel requested a review from a team as a code owner April 16, 2025 12:28

// IsRetryable determines if an error is retryable. Replace this with your own logic.
func IsRetryable(err error) bool {
return strings.Contains(err.Error(), "504 (Gateway Timeout)")
Copy link
Contributor

Choose a reason for hiding this comment

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

In Golang errors.Is and and errors.As are the preferred way to compare errors. Comparing error strings is very error prone. When using GRPC we can use its helper functions, so to achieve the same result we can do the following:

import (
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
)

func IsRetryable(err error) bool {
	return status.Code(err) == codes.Unavailable
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants