-
Notifications
You must be signed in to change notification settings - Fork 90
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
app/retry: refactor to not timeout exit duty #667
Conversation
Codecov Report
@@ Coverage Diff @@
## main #667 +/- ##
==========================================
- Coverage 55.11% 55.01% -0.10%
==========================================
Files 98 99 +1
Lines 9652 9664 +12
==========================================
- Hits 5320 5317 -3
- Misses 3561 3579 +18
+ Partials 771 768 -3
Continue to review full report at Codecov.
|
"github.com/obolnetwork/charon/app/errors" | ||
) | ||
|
||
// lateFactor defines the number of slots duties may be late. |
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.
nit
// lateFactor defines the number of slots duties may be late. | |
// lateFactor defines the number of slots that the duties may be late. |
return nil, err | ||
} | ||
|
||
duration, err := eth2Cl.SlotDuration(ctx) |
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.
nit: can rename duration to durationPerSlot
backoffProvider func() func() <-chan time.Time | ||
|
||
wg sync.WaitGroup | ||
} | ||
|
||
// DoAsync will execute the function including retries on network or context errors. | ||
// It is intended to be used asynchronously: | ||
// go retryer.DoAsync(ctx, duty.Slot, "foo", fn) | ||
func (r *Retryer) DoAsync(parent context.Context, slot int64, name string, fn func(context.Context) error) { | ||
// go retryer.DoAsync(ctx, duty, "foo", fn) |
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.
nit
// go retryer.DoAsync(ctx, duty, "foo", fn) | |
// USAGE: go retryer.DoAsync(ctx, duty, "foo", fn) |
Refactor
retryer
to support different timeouts for different duty types. Specificlally,DutyExit
should not timeout since it can be linked to any past or future slot.I had to make it generic, since
retryer
cannot importcore
which results in a import cycle. DefiningDeadlineFunc
in core also a makes a bit more sense, since thecore
package owns duties.category: refactor
ticket: #553