-
Notifications
You must be signed in to change notification settings - Fork 81
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
Make PollingBased waiter more flexible #3556
Conversation
OK, tests are failing and we need to adjust Actor correspondingly. |
6f35881
to
23b5016
Compare
@roman-khimov, regarding Actor integration I consider two options:
Which one do you prefer? Or may be there's another option. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3556 +/- ##
=======================================
Coverage 86.05% 86.05%
=======================================
Files 330 330
Lines 38692 38697 +5
=======================================
+ Hits 33297 33302 +5
Misses 3849 3849
Partials 1546 1546 ☔ View full report in Codecov by Sentry. |
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.
How about extending actor.Options
with waiter.PollConfig
?
I thought about it, but it's not really Acttor's configuration. Will add if you're OK with it. |
I'm also thinking of |
23b5016
to
e16afbd
Compare
I also thought about it, but WSBased does not use any configurable options now, thus I created just a PollConfig. Let's extend it while we're here, it'll be useful. |
43dba56
to
842fb8b
Compare
Linter job is failing, but it's just because golangci-lint version was updated, will be fixed in a separate PR. |
@roman-khimov, this one is ready for review. It's not needed for NeoFS anymore, but still it would be nice to have these values customizable. |
NeoFS is likely to still use it in some way. |
pkg/rpcclient/waiter/waiter.go
Outdated
// newCustomPollingBased is an internal constructor of PollingBased waiter that sets | ||
// default configuration values if needed. | ||
func newCustomPollingBased(waiter RPCPollingBased, v *result.Version, config PollConfig) *PollingBased { | ||
if config.PollInterval == 0 { |
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.
<=
?
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.
Fixed.
pkg/rpcclient/waiter/waiter.go
Outdated
if config.PollInterval == 0 { | ||
config.PollInterval = time.Millisecond * time.Duration(v.Protocol.MillisecondsPerBlock) / 2 | ||
} | ||
if config.RetryCount == 0 { |
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.
<=
?
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.
Fixed.
pollTime is never 0 since MillisecondsPerBlock protocol configuration value is present in `getversion` RPC response since 0.97.3 release. We don't have such old RPC servers in the network anymore, thus this fallback code may be safely removed. Signed-off-by: Anna Shaleva <[email protected]>
Some clients need more flexible awaiting options (e.g. for short-blocks networks). The default behaviour is not changed, all exported APIs are compatible. Ref. nspcc-dev/neofs-node#2864. Signed-off-by: Anna Shaleva <[email protected]>
Ensure that WSClient-based Actor is able to create EventBased waiter. Signed-off-by: Anna Shaleva <[email protected]>
Signed-off-by: Anna Shaleva <[email protected]>
Include Waiter.PollConfig into Waiter.Config and use extended Waiter configuration where needed. Signed-off-by: Anna Shaleva <[email protected]>
842fb8b
to
4255566
Compare
Networks with short block time can't use
1s
as a default poll interval, it's too harsh for them. Ref. nspcc-dev/neofs-node#2864.