-
Notifications
You must be signed in to change notification settings - Fork 26
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
Added backoff and retry logic #578
Conversation
Signed-off-by: Horiodino <holiodin@gmail.com>
Signed-off-by: Horiodino <holiodin@gmail.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #578 +/- ##
==========================================
- Coverage 64.02% 57.14% -6.89%
==========================================
Files 4 19 +15
Lines 303 1617 +1314
==========================================
+ Hits 194 924 +730
- Misses 78 600 +522
- Partials 31 93 +62 ☔ View full report in Codecov by Sentry. |
Hey @haydentherapper , I wasn’t able to view the reference you provided because the action logs have expired. Please make sure to test the changes and let me know the results. already added test case |
pkg/rekor/identity.go
Outdated
@@ -283,10 +284,19 @@ func GetCheckpointIndex(logInfo *models.LogInfo, checkpoint *util.SignedCheckpoi | |||
} | |||
|
|||
func IdentitySearch(startIndex int, endIndex int, rekorClient *client.Rekor, monitoredValues identity.MonitoredValues, outputIdentitiesFile string, idMetadataFile *string) ([]identity.MonitoredIdentity, error) { | |||
entries, err := GetEntriesByIndexRange(context.Background(), rekorClient, startIndex, endIndex) | |||
resp, err := util.Retry(context.Background(), func() (interface{}, error) { | |||
entries, err := GetEntriesByIndexRange(context.Background(), rekorClient, startIndex, endIndex) |
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.
Can we wrap each of the outbound calls in
rekor-monitor/pkg/rekor/client.go
Line 52 in e08902b
func GetEntriesByIndexRange(ctx context.Context, rekorClient *client.Rekor, start, end int) ([]models.LogEntry, error) { |
Signed-off-by: Horiodino <holiodin@gmail.com>
Signed-off-by: Horiodino <holiodin@gmail.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 so much, this looks great! Just a few tiny comments.
@@ -73,11 +74,13 @@ func GetEntriesByIndexRange(ctx context.Context, rekorClient *client.Rekor, star | |||
p := entries.NewSearchLogQueryParamsWithContext(ctx) | |||
p.SetEntry(&slq) | |||
|
|||
resp, err := rekorClient.Entries.SearchLogQuery(p) | |||
resp, err := util.Retry(ctx, func() (any, error) { | |||
return rekorClient.Entries.SearchLogQuery(p) |
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.
Can we wrap the other two usages of rekorClient
in the above functions?
pkg/rekor/identity.go
Outdated
@@ -32,7 +32,7 @@ import ( | |||
"github.com/sigstore/rekor/pkg/generated/models" | |||
"github.com/sigstore/rekor/pkg/pki" | |||
"github.com/sigstore/rekor/pkg/types" | |||
"github.com/sigstore/rekor/pkg/util" | |||
rekorutils "github.com/sigstore/rekor/pkg/util" |
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.
Undo?
pkg/util/retry_test.go
Outdated
@@ -0,0 +1,170 @@ | |||
// Copyright 2022 The Sigstore Authors. |
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.
// Copyright 2022 The Sigstore Authors. | |
// Copyright 2025 The Sigstore Authors. |
pkg/util/retry.go
Outdated
@@ -0,0 +1,190 @@ | |||
// Copyright 2022 The Sigstore Authors. |
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.
// Copyright 2022 The Sigstore Authors. | |
// Copyright 2025 The Sigstore Authors. |
Signed-off-by: Horiodino <holiodin@gmail.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.
thank you!
Summary
This PR adds retry logic for handling errors that are considered retryable types. The system will now automatically retry failed operations for a specified time duration and number of iterations
Fixes : #322 (comment)
Release Note
Documentation