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

Improve retries #183

Merged
merged 7 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions app/server/utils/retry/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ func (r *retrierDefault) Run(ctx context.Context, logger *zap.Logger, op Operati
err := op()

if err != nil {
// It's convinient to disable retries for negative tests
if md, ok := metadata.FromIncomingContext(ctx); ok {
if _, exists := md[common.ForbidRetries]; exists {
// It's convinient to disable retries for negative tests.
// These tests are marked with 'ForbidRetries' flag in GRPC Metadata.
md, mdExists := metadata.FromIncomingContext(ctx)
if mdExists {
if _, flagSet := md[common.ForbidRetries]; flagSet {
logger.Warn("retriable error occurred, but 'ForbidRetries' flag was set", zap.Error(err))
}

return backoff.Permanent(err)
return backoff.Permanent(err)
}
}

// Check if error is retriable
Expand Down
2 changes: 1 addition & 1 deletion common/consts.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package common

const (
ForbidRetries = "FORBID_RETRIES"
ForbidRetries = "forbid_retries"
)
2 changes: 1 addition & 1 deletion tests/suite/scenario.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestMissingDataSource[
IDBUILDER test_utils.ArrowIDBuilder[ID],
](s *Base[ID, IDBUILDER], dsi *api_common.TDataSourceInstance) {
// Do not retry negative tests
md := metadata.Pairs(common.ForbidRetries, "")
md := metadata.Pairs(common.ForbidRetries, "1")
ctx := metadata.NewOutgoingContext(context.Background(), md)

// read some table metadata to "heat" metrics
Expand Down
Loading