-
Notifications
You must be signed in to change notification settings - Fork 14
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
Balance monitoring retries #82
Conversation
The package was originally defined in keep-ecdsa repository https://github.com/keep-network/keep-ecdsa/blob/2fdf57d4e61f9dd313fb717c221605b5d812b187/pkg/utils/wrappers.go
We want to use a retry mechanism for single executions of the balance check. The retries will be performed during the period of `retryTimeout`, logging a warning on each error. When the timeout is hit an error will be logged and retries stopped. A next balance check will be triggered at the tick.
051d018
to
26fdfa2
Compare
We added a check execution at start of the monitoring. Previously we had to wait for ticker to invoke the first check.
The test checks calls to the balance source function. In the future we should check logged messages.
func (bm *BalanceMonitor) Observe( | ||
ctx context.Context, | ||
address Address, | ||
alertThreshold *Token, | ||
tick time.Duration, | ||
retryTimeout time.Duration, |
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.
Non-blocking but shouldn't we validate retryTimeout < tick
so that we do not have two checks overlapping?
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.
Yeah, good idea.
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.
On the other hand, don't we want to leave it to the implementation using this function?
We want to use a retry mechanism for single executions of the balance check.
The retries will be performed during the period of
retryTimeout
, logging a warning on each error. When the timeout is hit an error will be logged and retries stopped. The next balance check will be triggered at the next tick.