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

Increase proposal ping period #1493

Merged
merged 1 commit into from
Jan 10, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/di.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ func (di *Dependencies) bootstrapDiscoveryComponents(options node.OptionsDiscove

di.DiscoveryFinder = discoveryFinder
di.DiscoveryFactory = func() service.Discovery {
return discovery.NewService(di.IdentityRegistry, discoveryRegistry, 60*time.Second, di.SignerFactory, di.EventBus)
return discovery.NewService(di.IdentityRegistry, discoveryRegistry, options.PingInterval, di.SignerFactory, di.EventBus)
}
return nil
}
Expand Down
9 changes: 9 additions & 0 deletions config/flags_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package config
import (
"fmt"
"strings"
"time"

"github.com/mysteriumnetwork/node/metadata"
"github.com/rs/zerolog"
Expand All @@ -36,6 +37,12 @@ var (
Usage: `Proposal discovery adapter(s) separated by comma Options: { "api", "broker", "api,broker" }`,
Value: &cli.StringSlice{"api", "broker"},
}
// FlagDiscoveryPingInterval proposal ping interval in seconds.
FlagDiscoveryPingInterval = cli.DurationFlag{
Name: "discovery.ping",
Usage: `Proposal update interval `,
Value: 180 * time.Second,
}
// FlagBindAddress IP address to bind to.
FlagBindAddress = cli.StringFlag{
Name: "bind.address",
Expand Down Expand Up @@ -164,6 +171,7 @@ func RegisterFlagsNode(flags *[]cli.Flag) error {
*flags = append(*flags,
FlagBindAddress,
FlagDiscoveryType,
FlagDiscoveryPingInterval,
FlagFeedbackURL,
FlagFirewallKillSwitch,
FlagFirewallProtectedNetworks,
Expand Down Expand Up @@ -197,6 +205,7 @@ func ParseFlagsNode(ctx *cli.Context) {

Current.ParseStringFlag(ctx, FlagBindAddress)
Current.ParseStringSliceFlag(ctx, FlagDiscoveryType)
Current.ParseDurationFlag(ctx, FlagDiscoveryPingInterval)
Current.ParseStringFlag(ctx, FlagFeedbackURL)
Current.ParseBoolFlag(ctx, FlagFirewallKillSwitch)
Current.ParseStringFlag(ctx, FlagFirewallProtectedNetworks)
Expand Down
1 change: 1 addition & 0 deletions core/node/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ func GetDiscoveryOptions() *OptionsDiscovery {
return &OptionsDiscovery{
Types: types,
ProposalFetcherEnabled: true,
PingInterval: config.GetDuration(config.FlagDiscoveryPingInterval),
}
}

Expand Down
3 changes: 3 additions & 0 deletions core/node/options_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package node

import "time"

// DiscoveryType identifies proposal discovery provider
type DiscoveryType string

Expand All @@ -32,4 +34,5 @@ type OptionsDiscovery struct {
Types []DiscoveryType
Address string
ProposalFetcherEnabled bool
PingInterval time.Duration
}